pwshub.com

Automation with WebDriver BiDi now available on BrowserStack

Stay organized with collections Save and categorize content based on your preferences.

Matthias Rohmer

Over the last three years Chrome's Browser Automation team has been collaborating with other major browser and tooling vendors like BrowserStack to create WebDriver BiDi—a new browser automation protocol which enables bi-directional automation workflows across browsers. These workflows were previously only possible with the proprietary Chrome DevTools Protocol in Chromium-based browsers.

Today marks an important milestone of this shared effort as WebDriver BiDi finally becomes production-ready for developers, starting with BrowserStack today.

Selenium and BrowserStack

Recently BrowserStack became an official Development Partner of Selenium, a mature, open-source browser automation framework that also contributed to WebDriver BiDi. This partnership is a testament to BrowserStack's continued investment in a thriving testing ecosystem, with BrowserStack also employing several core maintainers of Selenium.

Part of the Selenium project is Selenium Grid, which lets you run tests across multiple devices in parallel. But setting a Grid up on your own, acquiring and maintaining dozens of different devices, and keeping them available can be challenging or even impossible for some.

Hosted Selenium Grid solutions like BrowserStack can make it easier to run your tests across many different platforms and devices—without managing them on your own.

WebDriver BiDi on Selenium Grid

Selenium is based on the WebDriver standard (note the missing BiDi) but has had experimental support for WebDriver BiDi for a while. Starting today, you can use WebDriver BiDi commands in production on BrowserStack's hosted Selenium Grid!

This finally enables features like request interception, advanced emulation, and handling browser events in real-time—and not just in Chrome, but in every browser that supports WebDriver BiDi.

The following example shows how to listen for log events, using WebDriver BiDi on BrowserStack. Caught logs are then also available for inspection on automate.browserstack.com:

const webdriver = require('selenium-webdriver');
// Insert credentials from https://www.browserstack.com/accounts/profile/details
const USERNAME = '<YOUR_USERNAME>';
const ACCESS_KEY = '<YOUR_ACCESS_KEY>';
(async () => {
  const driver = await (new webdriver.Builder()
    .withCapabilities({
      browserName: 'chrome',
      'bstack:options': {
        seleniumVersion: '4.22.0',
        seleniumBidi: true, // Enable WebDriver BiDi.
      },
    })
    .usingServer(
      `https://${USERNAME}:${ACCESS_KEY}@hub-cloud.browserstack.com/wd/hub`
    )
    .build());
  // Add a listener for log events.
  await driver.script().addConsoleMessageHandler((logEntry) => {
    console.log(logEntry.text);
  });
  await driver.get(
    'https://www.selenium.dev/selenium/web/bidi/logEntryAdded.html'
  );
  // Trigger a console log on the demo page.
  await driver.findElement({ id: 'consoleLog' }).click();
  await driver.quit();
  // Inspect logs on automate.browserstack.com!
})();

BrowserStack is just the beginning

The Chrome Browser Automation team congratulates the team at BrowserStack for launching their WebDriver BiDi support today! We are also looking forward to seeing the support for WebDriver BiDi expand across BrowserStack, other tools like Selenium, as well as other major browsers in the coming weeks.

And if this announcement made you excited about testing, but you haven't started your testing journey yet, make sure to check out our Learn Testing course on web.dev.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-08-01 UTC.

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }] [{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]

Source: developer.chrome.com

Related stories
1 month ago - We’re pleased to announce that, as of version 23, the Puppeteer browser automation library now has first-class support for Firefox. This means that it’s now easy to write automation and perform end-to-end testing using Puppeteer, and run...
3 weeks ago - Email marketing is the process of nurturing relationships with potential and existing customers through email. It’s a powerful tool that can boost your sales, enhance brand loyalty, and drive business growth. Leveraging the right email...
1 week ago - Business process management (BPM) tools help organizations design, execute, analyze, and optimize their business processes. Manual workflow planning and execution are time-consuming and require a lot of effort from employees. Business...
1 month ago - Helpdesk software is used to help customers quickly solve issues on their own, such as minor bugs and technical difficulties, meaning that they only need to contact agents for larger challenges. Businesses using traditional helpdesk...
1 month ago - As a developer, you'll likely work on a complex project at some point where deciphering the codebase feels like reading a whole novel. Engineers are code wizards, but even the best get lost in sprawling code. The challenge is that...
Other stories
22 minutes ago - The 2024 Gartner Magic Quadrant positions AWS as a Leader, reflecting our commitment to diverse virtual desktop solutions and operational excellence - driving innovation for remote and hybrid workforces.
1 hour ago - Understanding design patterns are important for efficient software development. They offer proven solutions to common coding challenges, promote code reusability, and enhance maintainability. By mastering these patterns, developers can...
1 hour ago - APIs (Application Programming Interfaces) play an important role in enabling communication between different software systems. However, with great power comes great responsibility, and securing these APIs is necessary to protect sensitive...
1 hour ago - This article aims to celebrate the power of introversion in UX research and design. Victor Yocco debunks common misconceptions, explores the unique strengths introverted researchers and designers bring to the table, and offers practical...
1 hour ago - The Zeigarnik effect explains why people tend to remember incomplete tasks first and complete work that’s already started. The post Understanding and applying the Zeigarnik effect appeared first on LogRocket Blog.