---
title: Selenium BiDi reference
description: Reference documentation for Allure Selenium BiDi | AllureWebDriverBiDi API | Log and network attachment schemas
---

# Allure Selenium BiDi reference

## AllureWebDriverBiDi

`io.qameta.allure.seleniumbidi.AllureWebDriverBiDi`

Captures browser log events and network events via the BiDi protocol and attaches them as JSON to the active Allure test result.

All configuration methods return `this` for method chaining. Configure the instance before calling `decorate()`.

### AllureWebDriverBiDi()

```java
new AllureWebDriverBiDi()
```

Creates an instance with default configuration: log capture enabled, network capture enabled, maximum 1000 log entries, maximum 2000 network events, default header redaction list.

### decorate

```java
<T extends WebDriver> T decorate(T driver)
```

Decorates the supplied `WebDriver` with BiDi event capture and returns the decorated instance. Use the returned driver for all test interactions.

Events are captured while an Allure test context is active. If the driver does not support BiDi — for example, because BiDi was not enabled on the driver options — the decoration still succeeds but no events are captured and no attachments are produced.

When `driver.quit()` is called on the decorated driver, the collected events are flushed as attachments to the active test result.

### logs

```java
AllureWebDriverBiDi logs(boolean enabled)
```

Whether to capture browser log events. Defaults to `true`. See [logs](/docs/selenium-bidi-configuration/#logs).

### network

```java
AllureWebDriverBiDi network(boolean enabled)
```

Whether to capture network events. Defaults to `true`. See [network](/docs/selenium-bidi-configuration/#network).

### maxLogEntries

```java
AllureWebDriverBiDi maxLogEntries(int maxLogEntries)
```

Maximum number of log entries to retain per test. Defaults to `1000`. Must be >= 0. See [maxLogEntries](/docs/selenium-bidi-configuration/#maxlogentries).

### maxNetworkEvents

```java
AllureWebDriverBiDi maxNetworkEvents(int maxNetworkEvents)
```

Maximum number of network events to retain per test. Defaults to `2000`. Must be >= 0. See [maxNetworkEvents](/docs/selenium-bidi-configuration/#maxnetworkevents).

### redactHeaders

```java
AllureWebDriverBiDi redactHeaders(String... headerNames)
```

Adds header names to the redaction list, extending the defaults. Each call replaces the previous call's additions — pass all custom header names in a single call. See [Redacting headers](/docs/selenium-bidi-configuration/#redacting-headers).

### close

```java
void close()
```

Flushes all buffered events as attachments to the active test result and closes the BiDi listeners. Normally this happens automatically when `driver.quit()` is called. Call `close()` explicitly when you need to flush before quit.

---

## Attachment schemas

Both attachments use content type `application/json`.

### Common envelope

Both the "WebDriver BiDi logs" and "WebDriver BiDi network" attachments share the same top-level structure:

| Field     | Type    | Description                                                     |
| --------- | ------- | --------------------------------------------------------------- |
| `entries` | array   | Collected log entries or network events.                        |
| `dropped` | integer | Number of events discarded because the entry limit was reached. |

### "WebDriver BiDi logs" entries

Each element of `entries` in the log attachment represents one browser log event.

Fields present on all log entries:

| Field        | Type   | Description                                                                                                                                                                                                                                               |
| ------------ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `event`      | string | Event kind: `"console"`, `"javascript"`, or `"generic"`.                                                                                                                                                                                                  |
| `timestamp`  | number | Event timestamp in milliseconds.                                                                                                                                                                                                                          |
| `level`      | string | Log level reported by the browser (e.g., `"info"`, `"warn"`, `"error"`). Omitted when not provided.                                                                                                                                                       |
| `text`       | string | Log message text. Omitted when not provided.                                                                                                                                                                                                              |
| `type`       | string | The log entry type string as reported by the browser. For `"console"` and `"javascript"` entries this equals the `event` value. For `"generic"` entries it carries the browser's own label, which may differ from `"generic"`. Omitted when not provided. |
| `source`     | object | Browsing context source. Omitted when not provided. See [Source](#source).                                                                                                                                                                                |
| `stackTrace` | object | Call stack at the point the event was emitted. Omitted when not provided. See [StackTrace](#stacktrace).                                                                                                                                                  |

Additional fields on `"console"` entries:

| Field    | Type   | Description                                                                                                           |
| -------- | ------ | --------------------------------------------------------------------------------------------------------------------- |
| `method` | string | Console method name (e.g., `"log"`, `"warn"`, `"error"`). Omitted when not provided.                                  |
| `args`   | array  | Arguments passed to the console call. Each element has the shape `{ type, value?, handle?, internalId?, sharedId? }`. |

#### Source

| Field               | Type   | Description                                             |
| ------------------- | ------ | ------------------------------------------------------- |
| `realm`             | string | Realm identifier. Omitted when not provided.            |
| `browsingContextId` | string | Browsing context identifier. Omitted when not provided. |

#### StackTrace

| Field        | Type  | Description                                                                                     |
| ------------ | ----- | ----------------------------------------------------------------------------------------------- |
| `callFrames` | array | List of stack frames. Each frame has `url?`, `functionName?`, `lineNumber`, and `columnNumber`. |

### "WebDriver BiDi network" entries

Each element of `entries` in the network attachment represents one network event.

Fields present on all network entries:

| Field               | Type             | Description                                                                                       |
| ------------------- | ---------------- | ------------------------------------------------------------------------------------------------- |
| `event`             | string           | Event kind: `"beforeRequestSent"`, `"responseStarted"`, `"responseCompleted"`, or `"fetchError"`. |
| `timestamp`         | number           | Event timestamp in milliseconds.                                                                  |
| `blocked`           | boolean          | Whether the request is currently blocked.                                                         |
| `redirectCount`     | number           | Number of redirects that have occurred.                                                           |
| `intercepts`        | array of strings | Active intercept identifiers.                                                                     |
| `browsingContextId` | string           | Browsing context identifier. Omitted when not provided.                                           |
| `navigationId`      | string           | Navigation identifier. Omitted when not provided.                                                 |
| `request`           | object           | Request data. Omitted when not provided. See [Request](#request).                                 |

Additional fields by event type:

| Event                                      | Additional field | Description                                                 |
| ------------------------------------------ | ---------------- | ----------------------------------------------------------- |
| `"beforeRequestSent"`                      | `initiator`      | How the request was initiated. See [Initiator](#initiator). |
| `"responseStarted"`, `"responseCompleted"` | `response`       | Response data. See [Response](#response).                   |
| `"fetchError"`                             | `errorText`      | Error description string.                                   |

#### Request

| Field         | Type   | Description                                                                 |
| ------------- | ------ | --------------------------------------------------------------------------- |
| `requestId`   | string | Unique request identifier. Omitted when not provided.                       |
| `url`         | string | Request URL. Omitted when not provided.                                     |
| `method`      | string | HTTP method (e.g., `"GET"`, `"POST"`). Omitted when not provided.           |
| `headers`     | array  | Request headers after redaction. See [Headers](#headers).                   |
| `headersSize` | number | Size of the request headers in bytes. Omitted when not provided.            |
| `timings`     | object | Fetch timing breakdown. Omitted when not provided. See [Timings](#timings). |

#### Response

| Field           | Type    | Description                                                               |
| --------------- | ------- | ------------------------------------------------------------------------- |
| `url`           | string  | Response URL. Omitted when not provided.                                  |
| `protocol`      | string  | Network protocol (e.g., `"http/1.1"`, `"h2"`). Omitted when not provided. |
| `status`        | number  | HTTP status code.                                                         |
| `statusText`    | string  | HTTP status text. Omitted when not provided.                              |
| `fromCache`     | boolean | Whether the response was served from cache.                               |
| `headers`       | array   | Response headers after redaction. See [Headers](#headers).                |
| `mimeType`      | string  | Response MIME type. Omitted when not provided.                            |
| `bytesReceived` | number  | Total bytes received.                                                     |
| `headersSize`   | number  | Size of the response headers in bytes.                                    |
| `bodySize`      | number  | Size of the response body in bytes.                                       |
| `contentLength` | number  | Value of the `Content-Length` header. Omitted when not present.           |

#### Initiator

| Field          | Type   | Description                                                                                                  |
| -------------- | ------ | ------------------------------------------------------------------------------------------------------------ |
| `type`         | string | Initiator type (e.g., `"script"`, `"parser"`). Omitted when not provided.                                    |
| `columnNumber` | number | Column number in the source. Omitted when not provided.                                                      |
| `lineNumber`   | number | Line number in the source. Omitted when not provided.                                                        |
| `requestId`    | string | Identifier of the initiating request. Omitted when not provided.                                             |
| `stackTrace`   | object | Call stack at the point the request was initiated. See [StackTrace](#stacktrace). Omitted when not provided. |

#### Headers

Headers are represented as an array of objects:

```json
[
  {
    "name": "Content-Type",
    "value": { "type": "string", "value": "application/json" }
  },
  {
    "name": "Authorization",
    "value": { "type": "string", "value": "[REDACTED]" }
  }
]
```

Each header object has `name` (string) and `value` (object with `type` and `value` fields). The `type` field is `"string"` for text values or `"base64"` for binary values. Redacted header values have their `value` field set to `"[REDACTED]"`.

#### Timings

Timing fields in milliseconds, mirroring the [Resource Timing](https://www.w3.org/TR/resource-timing/) model:

`timeOrigin`, `requestTime`, `redirectStart`, `redirectEnd`, `fetchStart`, `dnsStart`, `dnsEnd`, `connectStart`, `connectEnd`, `tlsStart`, `requestStart`, `responseStart`, `responseEnd`.
