New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

wd-bidi

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wd-bidi

package for implementing [webdriver BIDI](https://w3c.github.io/webdriver-bidi/). The alpha-4 has basic class to create, subscribe and listen to events. Currently, the development of this package is ongoing and the next release will include a simple API

  • 0.0.4-alpha-5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18
decreased by-35.71%
Maintainers
0
Weekly downloads
 
Created
Source

wd-bidi

package for implementing webdriver BIDI. The alpha-4 has basic class to create, subscribe and listen to events. Currently, the development of this package is ongoing and the next release will include a simple API for subscribing to and listening to multiple events. This will make it easier for developers to interact with the WebDriver BIDI protocol and handle multiple events within their applications.

API docs

Usage

npm i wd-bidi

Here is the sample code on implementation. Get complete code from github.

require('chromedriver');
const {Builder} = require('selenium-webdriver');
const Chrome= require('selenium-webdriver/chrome');
const opts = new Chrome.Options();
const { BIDI } = require('wd-bidi');

describe('Sample Bidi tests', ()=> {
  let driver;

  before(async ()=> {
    driver = await new Builder()
      .forBrowser('chrome')
      .setChromeOptions(opts.set('webSocketUrl', true))
      .build();
  })

  it('should listen to log events', async () => {
    const caps = await driver.getCapabilities();
    let WebSocketUrl = caps['map_'].get('webSocketUrl')
    const bidi = new BIDI(WebSocketUrl.replace('localhost', '127.0.0.1'));

    // Subscribe to log events
    await bidi.send({
      method: 'session.subscribe',
      params: { events: ['log.entryAdded'] }
    })

    // trigger an event
    await driver.executeScript('console.log("Hello Bidi")', [])

    // listen to logEvent message and print
    bidi.socket.on('message', (data) => {
      console.log(JSON.parse(Buffer.from(data.toString())))
    })
  })

  after(async ()=> await driver.quit())
})

FAQs

Package last updated on 10 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc