From 68bba2d4a7a6dcc3cd7bc6619fc0276e290aa599 Mon Sep 17 00:00:00 2001 From: Norbert Graf Date: Fri, 22 Aug 2025 17:37:49 +0200 Subject: [PATCH 1/3] bugfix: prevent error 'Error: Failed to execute WebDriver Bidi command "sessionSubscribe" as no Bidi session was established. Make sure you enable it by setting "webSocketUrl: true" in your capabilities and verify that your environment and browser supports it.' being printed to stdout when user deactivated Bidi protocol with "bidiProtocol" : false in Webdriver config. --- lib/helper/WebDriver.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/helper/WebDriver.js b/lib/helper/WebDriver.js index 69793ab1c..8f5a9172c 100644 --- a/lib/helper/WebDriver.js +++ b/lib/helper/WebDriver.js @@ -491,7 +491,7 @@ class WebDriver extends Helper { } config.capabilities.browserName = config.browser || config.capabilities.browserName - // WebDriver Bidi Protocol. Default: false + // WebDriver Bidi Protocol. Default: true config.capabilities.webSocketUrl = config.bidiProtocol ?? config.capabilities.webSocketUrl ?? true config.capabilities.browserVersion = config.browserVersion || config.capabilities.browserVersion @@ -629,7 +629,11 @@ class WebDriver extends Helper { this.browser.on('dialog', () => {}) - await this.browser.sessionSubscribe({ events: ['log.entryAdded'] }) + // Check for Bidi, because "sessionSubscribe" is an exclusive Bidi protocol feature. Otherwise, error will be thrown. + if (config.capabilities.webSocketUrl) { + await this.browser.sessionSubscribe({ events: ['log.entryAdded'] }) + } + this.browser.on('log.entryAdded', logEvents) return this.browser From 1e3f15cc19c20efcc40a89b8f837c638f0bd6b01 Mon Sep 17 00:00:00 2001 From: Norbert Graf Date: Fri, 22 Aug 2025 18:16:39 +0200 Subject: [PATCH 2/3] bugfix: prevent error 'Error: Failed to execute WebDriver Bidi command "sessionSubscribe" as no Bidi session was established. Make sure you enable it by setting "webSocketUrl: true" in your capabilities and verify that your environment and browser supports it.' being printed to stdout when user deactivated Bidi protocol with "bidiProtocol" : false in Webdriver config. --- lib/helper/WebDriver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helper/WebDriver.js b/lib/helper/WebDriver.js index 8f5a9172c..5772c51fb 100644 --- a/lib/helper/WebDriver.js +++ b/lib/helper/WebDriver.js @@ -630,7 +630,7 @@ class WebDriver extends Helper { this.browser.on('dialog', () => {}) // Check for Bidi, because "sessionSubscribe" is an exclusive Bidi protocol feature. Otherwise, error will be thrown. - if (config.capabilities.webSocketUrl) { + if (this.browser.capabilities && this.browser.capabilities.webSocketUrl) { await this.browser.sessionSubscribe({ events: ['log.entryAdded'] }) } From a4c2c0392df0aa51a953a5dff95b2401e868696f Mon Sep 17 00:00:00 2001 From: Norbert Graf Date: Tue, 2 Sep 2025 07:59:37 +0200 Subject: [PATCH 3/3] bugfix: prevent error 'Error: Failed to execute WebDriver Bidi command "sessionSubscribe" as no Bidi session was established. Make sure you enable it by setting "webSocketUrl: true" in your capabilities and verify that your environment and browser supports it.' being printed to stdout when user deactivated Bidi protocol with "bidiProtocol" : false in Webdriver config. --- lib/helper/WebDriver.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/helper/WebDriver.js b/lib/helper/WebDriver.js index 5772c51fb..84b3b50be 100644 --- a/lib/helper/WebDriver.js +++ b/lib/helper/WebDriver.js @@ -632,10 +632,9 @@ class WebDriver extends Helper { // Check for Bidi, because "sessionSubscribe" is an exclusive Bidi protocol feature. Otherwise, error will be thrown. if (this.browser.capabilities && this.browser.capabilities.webSocketUrl) { await this.browser.sessionSubscribe({ events: ['log.entryAdded'] }) + this.browser.on('log.entryAdded', logEvents) } - this.browser.on('log.entryAdded', logEvents) - return this.browser }