new thenableWebDriverProxy(sessionnon-null, …rest)
| Name | Type | Attributes | Description |
|---|---|---|---|
session | IThenable.<!Session> | ||
rest | ? | <repeatable> |
- Implements
Extends
Members
catch
then
Methods
(async) addCredential(credential)
Injects a credential into the authenticator.
| Name | Type | Description |
|---|---|---|
credential | Credential to be added |
- Overrides
- Source
(async) addVirtualAuthenticator(options)
Adds a virtual authenticator with the given options.
| Name | Type | Description |
|---|---|---|
options | VirtualAuthenticatorOptions object to set authenticator options. |
- Overrides
- Source
(async) createCDPConnection() → (non-null) {Promise.<resolved>}
Creates a new WebSocket connection.
- Overrides
- Source
A new CDP instance.
- Type:
- Promise.<resolved>
(async) fireSessionEvent(eventType, payloadopt) → (non-null) {Promise.<Object>}
Fires a custom session event to the remote server event bus.
This allows test code to trigger server-side utilities that subscribe to the event bus.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
eventType | string | The type of event (e.g., "test:failed", "log:collect"). | ||
payload | Object | <optional> | null | Optional data to include with the event. |
- Overrides
- Source
A promise that resolves to the response containing success status, event type, and timestamp.
- Type:
- Promise.<Object>
// Fire a simple event
await driver.fireSessionEvent('test:started');// Fire an event with payload
await driver.fireSessionEvent('test:failed', {
testName: 'LoginTest',
error: 'Element not found'
});getAccessibilitySnapshot(optionsopt) → (non-null) {Promise.<!AccessibilityNode>}
Snapshots the accessibility tree of the current browsing context.
The tree is computed in the page from the DOM, following WAI-ARIA, html-aam and accname; it is not the browser's own accessibility tree. It is rooted at the driver's current browsing context: the top-level document, or the frame the driver has switched into. Every child frame's tree is attached under its iframe node, and the driver's current browsing context is left as it was. Works in both WebDriver Classic and BiDi sessions. The snapshot is a copy taken at one point in time.
const tree = await driver.getAccessibilitySnapshot()
console.log(tree.toText())
await tree.children[0].element.click()
| Name | Type | Attributes | Description |
|---|---|---|---|
options | Object | <optional> | With |
- Overrides
- Source
The root node, of role document, named from the title.
- Type:
- Promise.<!AccessibilityNode>
getBidi()
Returns the WebDriver BiDi connection for this session.
- Overrides
- Deprecated
- BiDi is an internal implementation detail — this accessor hands back the raw transport directly, which is no longer supported public API. Use a composed BiDi module instead, e.g. `Network.create(driver)` or `require('selenium-webdriver/bidi/network')`.
- Source
(async) getCredentials()
- Overrides
- Source
The list of credentials owned by the authenticator.
(async) getWsUrl(debuggerAddress, target, caps) → {string}
Retrieves 'webSocketDebuggerUrl' by sending a http request using debugger address
| Name | Type | Description |
|---|---|---|
debuggerAddress | string | |
target | ||
caps |
- Overrides
- Source
Returns parsed webSocketDebuggerUrl obtained from the http request
- Type:
- string
(async) installWebExtension(extension, optionsopt) → (non-null) {Promise.<!webExtension.WebExtension>}
Installs a browser extension. Works with remote (Grid) sessions: a directory is uploaded to the remote end first, and an archive or base64 bytes are sent inline.
Requires BiDi (see options.enableBidi()). Chromium installs only unpacked directories (SeleniumHQ/selenium#16541); Firefox also installs without BiDi, see ../firefox.Driver#installWebExtension.
const extension = await driver.installWebExtension('/path/to/extension')
await driver.uninstallWebExtension(extension)
| Name | Type | Attributes | Description |
|---|---|---|---|
extension | string | an unpacked extension directory, a packed extension file (.xpi/.crx/.zip), or base64-encoded bytes of one. | |
options | Object.<string, boolean> | <optional> | browser-specific install options. This browser supports none; see ../firefox.Driver#installWebExtension for Firefox's. |
- Overrides
- Source
if an option is given that this browser cannot honor.
- Type
- error.
InvalidArgumentError
if the session was created without BiDi.
- Type
- error.
UnsupportedOperationError
the installed extension.
- Type:
- Promise.<!webExtension.WebExtension>
(async) logMutationEvents(connection, callback) → {Promise.<void>}
| Name | Type | Description |
|---|---|---|
connection | ||
callback |
- Overrides
- Source
- Type:
- Promise.<void>
(async) normalize_(webElementPromisenon-null) → (non-null) {Promise.<!WebElement>}
| Name | Type | Description |
|---|---|---|
webElementPromise | function | The webElement in unresolved state |
- Overrides
- Source
First single WebElement from array of resolved promises
- Type:
- Promise.<!WebElement>
(async) onIntercept(connection, httpResponse, callback)
Handle Network interception requests
| Name | Type | Description |
|---|---|---|
connection | WebSocket connection to the browser | |
httpResponse | Object representing what we are intercepting as well as what should be returned. | |
callback | callback called when we intercept requests. |
- Overrides
- Source
(async) onLogEvent(connection, callback) → {Promise.<void>}
| Name | Type | Description |
|---|---|---|
connection | ||
callback |
- Overrides
- Source
- Type:
- Promise.<void>
(async) onLogException(connection, callback) → {Promise.<void>}
| Name | Type | Description |
|---|---|---|
connection | ||
callback |
- Overrides
- Source
- Type:
- Promise.<void>
(async) register(username, password, connection)
Sets a listener for Fetch.authRequired event from CDP If event is triggered, it enters username and password and allows the test to move forward
| Name | Type | Description |
|---|---|---|
username | string | |
password | string | |
connection | CDP Connection |
- Overrides
- Source
(async) removeAllCredentials()
Removes all the credentials from the authenticator.
- Overrides
- Source
(async) removeCredential(credential_id)
Removes a credential from the authenticator.
| Name | Type | Description |
|---|---|---|
credential_id | The ID of the credential to be removed. |
- Overrides
- Source
(async) removeVirtualAuthenticator()
Removes a previously added virtual authenticator. The authenticator is no longer valid after removal, so no methods may be called.
- Overrides
- Source
(async) setUserVerified(verified)
Sets whether the authenticator will simulate success or fail on user verification.
| Name | Type | Description |
|---|---|---|
verified | true if the authenticator will pass user verification, false otherwise. |
- Overrides
- Source
(async) uninstallWebExtension(extensionnon-null) → (non-null) {Promise.<void>}
Uninstalls a browser extension installed with #installWebExtension.
| Name | Type | Description |
|---|---|---|
extension | webExtension. | the extension returned by #installWebExtension. |
- Overrides
- Source
if
extensionis not aWebExtension.- Type
- error.
InvalidArgumentError
if the session was created without BiDi.
- Type
- error.
UnsupportedOperationError
A promise that resolves once the extension is removed.
- Type:
- Promise.<void>
virtualAuthenticatorId()
- Overrides
- Source
The value of authenticator ID added