---
title: Selenium WebDriver BiDi | TestingBot Blog
description: WebDriver BiDi support is now available on TestingBot. Learn how to use
  this exciting new improvement with your Selenium tests.
source_url:
  html: https://testingbot.com/blog/webdriver-bidi
  md: https://testingbot.com/blog/webdriver-bidi.md
---

# Run Selenium 4 BiDi tests on TestingBot

WebDriver BiDi support is now available on TestingBot. Learn how to use this exciting new improvement with your Selenium tests.

By [Jochen D.](https://testingbot.com/about/jochen-d)2024-08-14

 Share on Facebook 

 Share on Twitter 

 Post on Reddit 

 Share link 

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](https://www.selenium.dev/documentation/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](https://testingbot.com/support/web-automate/selenium/selenium-bidi) 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:

- `webSocketUrl` capability set to `true`
- `selenium-version` capability set to Selenium 4, for example`4.23.0`

### Browser support for BiDi

Important to know is that Chrome, Edge and Firefox currently [fully support WebDriver bidi](https://wpt.fyi/results/webdriver/tests/bidi?label=experimental&label=master&aligned), 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](https://testingbot.com/support/web-automate/selenium/selenium-bidi#example-console).

```java
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.bidi.module.LogInspector;
import org.openqa.selenium.remote.Augmenter;
import org.openqa.selenium.MutableCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

public class ListenToConsoleLogs {
  public static final String KEY = "KEY";
  public static final String SECRET = "SECRET";
  public static final String REMOTE_URL = "https://" + KEY + ":" + SECRET + "@hub.testingbot.com/wd/hub";
  static Boolean success = false;

   public static void main(String[] args) throws MalformedURLException {
       MutableCapabilities capabilities = new MutableCapabilities();
       capabilities.setCapability("browserName", "chrome");
       capabilities.setCapability("webSocketUrl", true);
       HashMap<String, Object> testingbotOptions = new HashMap<>();
       testingbotOptions.put("selenium-version", "4.23.0");
       capabilities.setCapability("tb:options", testingbotOptions);

       WebDriver driver = new RemoteWebDriver(new URL(REMOTE_URL), capabilities);

       try {
           Augmenter augmenter = new Augmenter();
           driver = augmenter.augment(driver);

           try (LogInspector logInspector = new LogInspector(driver)) {
               logInspector.onConsoleEntry(consoleLogEntry -> {
                   System.out.println("text: " + consoleLogEntry.getText());
                   System.out.println("level: " + consoleLogEntry.getLevel());
                   success = true;
               });

               String page = "https://www.selenium.dev/selenium/web/bidi/logEntryAdded.html";
               driver.get(page);
               driver.findElement(By.id("consoleLog")).click();
  
               if (success) {
                   markTestStatus(true, "Console logs streaming", driver);
               } else {
                   markTestStatus(false, "Console logs did not stream", driver);
               }
               driver.quit();
           }
       } catch (Exception e) {
          markTestStatus(false, "Exception!", driver);
          e.printStackTrace();
          driver.quit();
       }
   }

   public static void markTestStatus(Boolean status, String reason, WebDriver driver) {
    TestingbotREST r = new TestingbotREST("key", "secret");
    Map<String, String> data = new HashMap<String, String>();
    data.put("success", "1");
    data.put("name", "My Test");
    r.updateTest(driver.getSessionId(), data);
   }
}
```

### Future features for BiDi

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

- Listen for DOM events
- Dynamic changes to iframe or documents
- Performance timings
- [Bootstrap Scripts](https://github.com/w3c/webdriver-bidi/blob/main/proposals/bootstrap-scripts.md)

WebDriver Bidi is already gaining traction amongst testers, for example [Puppeteer will now use BiDi for Firefox automation](https://developer.chrome.com/blog/firefox-support-in-puppeteer-with-webdriver-bidi?hl=en), which means [support for CDP in Firefox will be removed](https://hacks.mozilla.org/2024/08/puppeteer-support-for-firefox/).

If you would like to get started with BiDi, feel free to [sign up for a free trial](https://testingbot.com/users/sign_up) and start running tests on remote browsers.

[← Previous post Test your website and mobile apps on iOS 18.](https://testingbot.com/blog/ios-18-testing) [Next post → Electron Automated Testing](https://testingbot.com/blog/electron-automated-testing)

## Sidebar

### TestingBot Cloud Testing

Run automated, manual and visual tests on remote browsers and devices. Sign up for a free trial.

[Free Trial](https://testingbot.com/users/sign_up)

### Latest articles

[![Announcing AI Test Insights](https://testingbot.com/assets/blog/2026/ai-insights.jpg)](https://testingbot.com/blog/ai-test-insights)

#### Announcing AI Test Insights

Use AI Insights to quickly discover why an automated test...

[Read: Announcing AI Test Insights](https://testingbot.com/blog/ai-test-insights)

[![Selenium vs Playwright 2026](https://testingbot.com/assets/blog/2026/selenium-vs-playwright-2026.jpg)](https://testingbot.com/blog/selenium-vs-playwright)

#### Selenium vs Playwright 2026

Comparing Selenium vs Playwright - which is the best test...

[Read: Selenium vs Playwright 2026](https://testingbot.com/blog/selenium-vs-playwright)

[![Maestro Physical Device Testing](https://testingbot.com/assets/blog/2026/maestro-physical.jpg)](https://testingbot.com/blog/maestro-physical-device-testing)

#### Maestro Physical Device Testing

Maestro testing in parallel on physical Android and iOS d...

[Read: Maestro Physical Device Testing](https://testingbot.com/blog/maestro-physical-device-testing)

## Related Articles

[![Selenium vs Playwright 2026](https://testingbot.com/assets/blog/2026/selenium-vs-playwright-2026.jpg)](https://testingbot.com/blog/selenium-vs-playwright "Selenium vs Playwright 2026")

### [Selenium vs Playwright 2026](https://testingbot.com/blog/selenium-vs-playwright)

Comparing Selenium vs Playwright - which is the best test framework for your usecase?

[Read article →](https://testingbot.com/blog/selenium-vs-playwright)

[![Selenium 20th birthday](https://testingbot.com/assets/blog/2024/selenium20.webp)](https://testingbot.com/blog/selenium-20-years "Selenium 20th birthday")

### [Selenium 20th birthday](https://testingbot.com/blog/selenium-20-years)

Celebrate Selenium's 20th birthday. An overview of the years.

[Read article →](https://testingbot.com/blog/selenium-20-years)

[![Playwright Testing on TestingBot](https://testingbot.com/assets/blog/2023/playwright-testing.jpg)](https://testingbot.com/blog/playwright-testing-introduction "Playwright Testing on TestingBot")

### [Playwright Testing on TestingBot](https://testingbot.com/blog/playwright-testing-introduction)

Learn how Playwright can run your automated tests on a variety of browsers, local or remote browsers on TestingBot.

[Read article →](https://testingbot.com/blog/playwright-testing-introduction)

[![macOS Ventura Automated Testing](https://testingbot.com/assets/blog/2023/ventura.jpg)](https://testingbot.com/blog/macos-ventura-testing "macOS Ventura Automated Testing")

### [macOS Ventura Automated Testing](https://testingbot.com/blog/macos-ventura-testing)

TestingBot now offers macOS Ventura testing in the cloud! Test on ARM-based VMs.

[Read article →](https://testingbot.com/blog/macos-ventura-testing)

## More by Jochen D.

[![Announcing AI Test Insights](https://testingbot.com/assets/blog/2026/ai-insights.jpg)](https://testingbot.com/blog/ai-test-insights "Announcing AI Test Insights")
### [Announcing AI Test Insights](https://testingbot.com/blog/ai-test-insights)

Use AI Insights to quickly discover why an automated test failed.

[![Maestro Physical Device Testing](https://testingbot.com/assets/blog/2026/maestro-physical.jpg)](https://testingbot.com/blog/maestro-physical-device-testing "Maestro Physical Device Testing")
### [Maestro Physical Device Testing](https://testingbot.com/blog/maestro-physical-device-testing)

Maestro testing in parallel on physical Android and iOS devices.

[![tvOS Physical Device Testing](https://testingbot.com/assets/blog/2025/appletv.jpg)](https://testingbot.com/blog/tvos-automated-testing "tvOS Physical Device Testing")
### [tvOS Physical Device Testing](https://testingbot.com/blog/tvos-automated-testing)

Run automated tvOS tests on physical AppleTV devices.

[See all posts by Jochen D. →](https://testingbot.com/about/jochen-d)

## Ready to start testing?
[Start a free trial](https://testingbot.com/users/sign_up)
