TestingBot Blog

TestingBot provides a cloud of browsers and devices, ready to run your Automated, Live and Visual tests.

< Back to Blog Overview

Run Selenium 4 BiDi tests on TestingBot

2024-08-14

Selenium 4 is the latest version of the widely-used open-source browser testing framework. A new feature introduced in this version is support for the WebDriver BiDi protocol.

TestingBot is happy to announce that it is now possible to run Selenium automated tests on the TestingBot browser grid with WebDriver Bidi.

The WebDriver BiDi protocol is designed to offer a stable, cross-browser API that enables bidirectional communication between the test script and the (remote) browser. This new protocol improves upon learnings from the WebDriver protocol, which is based on HTTP and only supports unidirectional communication.

With the BiDi protocol, communication occurs over WebSockets through JSON-RPC messaging. This unlocks new capabilities such as intercepting network requests, mocking backends, performing basic authentication and accessing console logs in real-time.

To get started, please read the Selenium BiDi documentation which consists of examples on how to run tests with BiDi.

Important to remember is that you need at least 2 capabilities in your Selenium tests to use WebDriver BiDi:

Browser support for BiDi

Important to know is that Chrome, Edge and Firefox currently fully support WebDriver bidi, while other browser vendors such as Safari have yet to implement this new protocol.

This means you can only run BiDi tests on remote Chrome, Firefox and Edge browsers on TestingBot.

Listen to console.log events

One of the useful new features that comes with BiDi is the ability to listen to browser events as they happen. For example, let's say you want to retrieve in realtime the console.logs that are generated while testing a website.

Below is an example on how to set this up with Java. For other programming languages, please see the console bidi examples.

Future features for BiDi

The bidirectional communication will introduce exciting new concepts and features for tests, which may include new features such as:

WebDriver Bidi is already gaining traction amongst testers, for example Puppeteer will now use BiDi for Firefox automation, which means support for CDP in Firefox will be removed.

If you would like to get started with BiDi, feel free to sign up for a free trial and start running tests on remote browsers.

< Back to Blog Overview

Sign up for a Free Trial

Start testing your apps with TestingBot.

No credit card required.