Getting started with Allure Selenium BiDi
Capture browser log events and network events from Selenium WebDriver 4 tests using the BiDi protocol, and attach them as diagnostics to your Allure Report test results. The integration targets Selenium WebDriver 4 with BiDi support and is validated against Selenium Java 4.44.
Allure Selenium BiDi is compatible with any Allure Java framework integration, including Allure JUnit 5 and Allure TestNG. Requires Java 17 or newer.
To enable the integration in your project:
Make sure you have an Allure integration set up for the test framework you use.
See the instructions in the integration's documentation in Frameworks.
Add
allure-selenium-bidito your project dependencies.xml<!-- Define the version of Allure you want to use via the allure.version property --> <properties> <allure.version>VERSION</allure.version> </properties> <!-- Add allure-bom to dependency management to ensure correct versions of all the dependencies are used --> <dependencyManagement> <dependencies> <dependency> <groupId>io.qameta.allure</groupId> <artifactId>allure-bom</artifactId> <version>${allure.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>io.qameta.allure</groupId> <artifactId>allure-selenium-bidi</artifactId> <scope>test</scope> </dependency> </dependencies>ktsval allureVersion = "VERSION" dependencies { testImplementation(platform("io.qameta.allure:allure-bom:$allureVersion")) testImplementation("io.qameta.allure:allure-selenium-bidi") }groovydef allureVersion = "VERSION" dependencies { testImplementation platform("io.qameta.allure:allure-bom:$allureVersion") testImplementation "io.qameta.allure:allure-selenium-bidi" }Enable BiDi on your WebDriver options.
javaChromeOptions options = new ChromeOptions().enableBiDi();BiDi must be enabled at the driver level — without it, the integration silently produces no attachments. Check your browser's Selenium documentation for BiDi support.
Decorate your WebDriver instance with
AllureWebDriverBiDi.javaimport io.qameta.allure.seleniumbidi.AllureWebDriverBiDi; AllureWebDriverBiDi bidi = new AllureWebDriverBiDi(); WebDriver driver = bidi.decorate(new ChromeDriver(options));Use the decorated driver for all test interactions. When
driver.quit()is called, the collected browser log and network events are flushed as JSON attachments to the active test result.INFO
Events are only captured and attached while there is an active Allure test context. Browser activity that happens outside of a test — for example, in setup code that runs before any test starts — is not captured. Similarly, if
driver.quit()is called after the test has ended (for example, in teardown code that runs after the test result is finalized), the collected events are not attached.Run your tests and generate a test report the same way as you would normally.
Report output
Each test result receives up to two JSON attachments:
- WebDriver BiDi logs — browser log events including console output (
console.log,console.warn,console.error, etc.), uncaught JavaScript exceptions, and other generic browser log entries. - WebDriver BiDi network — network events:
beforeRequestSent,responseStarted,responseCompleted, andfetchError.
An attachment is omitted when no events of that type were received during the test and none were dropped.
Sensitive header values are redacted by default. See configuration to control which event types are captured, set per-test entry limits, or customize header redaction. See reference for the full attachment schema.
Closing the listener manually
Attachments are flushed when driver.quit() is called on the decorated driver. To flush earlier — for example, before teardown logic runs — call bidi.close() explicitly:
bidi.close(); // flush buffered events as attachments now
driver.quit(); // then quit the browser — no second flush occursINFO
close() has the same context requirement as driver.quit(): events are only attached if an active Allure test context exists when close() is called. If you call it after the test result has been finalized, the collected events are discarded.
After close(), the subsequent driver.quit() does not produce a second flush — the session has already been removed.