Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: BiDi is not working (Firefox/Chrome) #13896

Closed
DashwoodIce9 opened this issue May 2, 2024 · 5 comments
Closed

[🐛 Bug]: BiDi is not working (Firefox/Chrome) #13896

DashwoodIce9 opened this issue May 2, 2024 · 5 comments

Comments

@DashwoodIce9
Copy link

DashwoodIce9 commented May 2, 2024

What happened?

Hi, I am trying to intercept and modify network requests using WebDriver BiDi API. I have tried with Firefox and Chrome on MacOS and Linux and in all cases it has failed to work for me. I am getting an error like the following. The prakhar.App.main(App.java:xx) line in the stacktrace corresponds to the Network network = new Network(webDriver) line in the code examples shared below.

With Firefox -

// On MacOS
org.openqa.selenium.bidi.BiDiException: This version of Firefox or geckodriver does not support Bidi
Build info: version: '4.20.0', revision: '866c76ca80'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '14.4.1', java.version: '17.0.11'
Driver info: BiDi Connection
        at org.openqa.selenium.firefox.FirefoxDriver.getBiDi(FirefoxDriver.java:384)
        at org.openqa.selenium.bidi.module.Network.<init>(Network.java:77)
        at org.openqa.selenium.bidi.module.Network.<init>(Network.java:62)
        at prakhar.App.main(App.java:45)
// On Linux
org.openqa.selenium.bidi.BiDiException: This version of Firefox or geckodriver does not support Bidi
Build info: version: '4.20.0', revision: '866c76ca80'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.214-180.855.amzn2int.x86_64', java.version: '17.0.11'
Driver info: BiDi Connection
        at org.openqa.selenium.firefox.FirefoxDriver.getBiDi(FirefoxDriver.java:384)
        at org.openqa.selenium.bidi.module.Network.<init>(Network.java:77)
        at org.openqa.selenium.bidi.module.Network.<init>(Network.java:62)
        at prakhar.App.main(App.java:46)

With Chrome -

// On MacOS
org.openqa.selenium.bidi.BiDiException: Unable to create a BiDi connection
Build info: version: '4.20.0', revision: '866c76ca80'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '14.4.1', java.version: '17.0.11'
Driver info: BiDi Connection
        at org.openqa.selenium.bidi.HasBiDi.lambda$getBiDi$0(HasBiDi.java:25)
        at java.base/java.util.Optional.orElseThrow(Optional.java:403)
        at org.openqa.selenium.bidi.HasBiDi.getBiDi(HasBiDi.java:25)
        at org.openqa.selenium.bidi.module.Network.<init>(Network.java:77)
        at org.openqa.selenium.bidi.module.Network.<init>(Network.java:62)
        at prakhar.App.main(App.java:46)
// On Linux
org.openqa.selenium.bidi.BiDiException: Unable to create a BiDi connection
Build info: version: '4.20.0', revision: '866c76ca80'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.214-180.855.amzn2int.x86_64', java.version: '17.0.11'
Driver info: BiDi Connection
        at org.openqa.selenium.bidi.HasBiDi.lambda$getBiDi$0(HasBiDi.java:25)
        at java.base/java.util.Optional.orElseThrow(Optional.java:403)
        at org.openqa.selenium.bidi.HasBiDi.getBiDi(HasBiDi.java:25)
        at org.openqa.selenium.bidi.module.Network.<init>(Network.java:77)
        at org.openqa.selenium.bidi.module.Network.<init>(Network.java:62)
        at prakhar.App.main(App.java:47)

How can we reproduce the issue?

/*
 * This Java source file was generated by the Gradle 'init' task.
 */

// For Firefox
package prakhar;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Duration;

import org.openqa.selenium.OutputType;
import org.openqa.selenium.bidi.module.Network;
import org.openqa.selenium.bidi.network.AddInterceptParameters;
import org.openqa.selenium.bidi.network.ContinueRequestParameters;
import org.openqa.selenium.bidi.network.InterceptPhase;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxDriverLogLevel;
import org.openqa.selenium.firefox.FirefoxDriverService;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.GeckoDriverService;

public class App {
    private static final File FIREFOX_LOG_FILE = new File("firefox.log");

    public static String getGreeting(){
        return "Hello";
    }
    
    public static void main(String... args) {
        try (
            FirefoxDriverService firefoxDriverService = new GeckoDriverService.Builder()
                .withTruncatedLogs(false)
                .withLogLevel(FirefoxDriverLogLevel.DEBUG)
                .withLogFile(FIREFOX_LOG_FILE)
                .build()
        ) {
            FirefoxOptions firefoxOptions = new FirefoxOptions();
            firefoxOptions.setImplicitWaitTimeout(Duration.ofSeconds(1));
            firefoxOptions.setAcceptInsecureCerts(false);
            FirefoxDriver firefoxDriver = new FirefoxDriver(firefoxDriverService, firefoxOptions);
            try(Network network = new Network(firefoxDriver)) {
                network.addIntercept(new AddInterceptParameters(InterceptPhase.BEFORE_REQUEST_SENT));
                network.onBeforeRequestSent(beforeRequestSent -> {
                    ContinueRequestParameters continueRequestParameters = new ContinueRequestParameters(
                            beforeRequestSent.getRequest().getRequestId());
                    continueRequestParameters.headers(beforeRequestSent.getRequest().getHeaders());
                    network.continueRequest(continueRequestParameters);
                });
                firefoxDriver.get("https://example.com");
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                firefoxDriver.quit();
                firefoxDriverService.stop();
            }
        }
    }
}

/*
============================================================================
*/

/*
 * This Java source file was generated by the Gradle 'init' task.
 */
// For Chrome
package prakhar;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Duration;

import org.openqa.selenium.OutputType;
import org.openqa.selenium.bidi.module.Network;
import org.openqa.selenium.bidi.network.AddInterceptParameters;
import org.openqa.selenium.bidi.network.ContinueRequestParameters;
import org.openqa.selenium.bidi.network.InterceptPhase;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxDriverLogLevel;
import org.openqa.selenium.firefox.FirefoxDriverService;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.GeckoDriverService;

public class App {
    private static final File CHROME_LOG_FILE = new File("firefox.log");

    public static String getGreeting(){
        return "Hello";
    }
    
    public static void main(String... args) {
        try (
            ChromeDriverService chromeDriverService = new ChromeDriverService.Builder()
                .withAppendLog(true)
                .withReadableTimestamp(true)
                .withLogFile(CHROME_LOG_FILE)
                .withVerbose(true)
                .build()
        ) {
            ChromeOptions chromeOptions = new ChromeOptions();
            chromeOptions.setImplicitWaitTimeout(Duration.ofSeconds(1));
            chromeOptions.setAcceptInsecureCerts(false);
            ChromeDriver chromeDriver = new ChromeDriver(chromeDriverService, chromeOptions);
            try(Network network = new Network(chromeDriver)) {
                network.addIntercept(new AddInterceptParameters(InterceptPhase.BEFORE_REQUEST_SENT));
                network.onBeforeRequestSent(beforeRequestSent -> {
                    ContinueRequestParameters continueRequestParameters = new ContinueRequestParameters(
                            beforeRequestSent.getRequest().getRequestId());
                    continueRequestParameters.headers(beforeRequestSent.getRequest().getHeaders());
                    network.continueRequest(continueRequestParameters);
                });
                chromeDriver.get("https://example.com");
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                chromeDriver.quit();
                chromeDriverService.stop();
            }
        }
    }
}

Relevant log output

=======================================
Selenium logs (tried to grab ones with the word "selenium" in them, please let me know if full logs are required and I can share those as well)
=======================================

May 02, 2024 9:54:03 AM org.openqa.selenium.manager.SeleniumManager getBinary
FINE: Selenium Manager binary found at: /Users/prakhaga/.cache/selenium/manager/0.4.20/selenium-manager
May 02, 2024 9:54:03 AM org.openqa.selenium.manager.SeleniumManager runCommand
FINE: Executing Process: [--browser, firefox, --language-binding, java, --output, json, --debug]
May 02, 2024 9:54:04 AM org.openqa.selenium.os.ExternalProcess$Builder lambda$start$0
FINE: completed to copy the output of process 95329
May 02, 2024 9:54:04 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: geckodriver not found in PATH
May 02, 2024 9:54:04 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: firefox detected at /Applications/Firefox.app/Contents/MacOS/firefox
May 02, 2024 9:54:04 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Running command: /Applications/Firefox.app/Contents/MacOS/firefox -v
May 02, 2024 9:54:04 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Output: "Mozilla Firefox 124.0.2"
May 02, 2024 9:54:04 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Detected browser: firefox 124.0.2
May 02, 2024 9:54:04 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Required driver: geckodriver 0.34.0
May 02, 2024 9:54:04 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: geckodriver 0.34.0 already in the cache
May 02, 2024 9:54:04 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Driver path: /Users/prakhaga/.cache/selenium/geckodriver/mac64/0.34.0/geckodriver
May 02, 2024 9:54:04 AM org.openqa.selenium.manager.SeleniumManager lambda$runCommand$1
FINE: Browser path: /Applications/Firefox.app/Contents/MacOS/firefox
May 02, 2024 9:54:04 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executing: newSession [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: false, browserName: firefox, moz:debuggerAddress: true, moz:firefoxOptions: {binary: /Applications/Firefox.app/C...}, timeouts: {implicit: 1000}}]}]
May 02, 2024 9:54:04 AM org.openqa.selenium.remote.service.DriverService start
FINE: Starting driver at /Users/prakhaga/.cache/selenium/geckodriver/mac64/0.34.0/geckodriver with [--port=19933, --websocket-port=8114, --allow-origins, http://127.0.0.1:8114, http://localhost:8114, http://[::1]:8114, --log, debug, --log-no-truncate]
May 02, 2024 9:54:04 AM org.openqa.selenium.remote.http.jdk.JdkHttpClient execute0
FINE: Executing request: (POST) /session
May 02, 2024 9:54:04 AM jdk.internal.net.http.HttpClientImpl sendAsync
FINE: [Forwarding newSession on session null to remote] [354ms] HttpClientImpl(1) ClientImpl (async) send http://localhost:19933/session POST
May 02, 2024 9:54:07 AM org.openqa.selenium.remote.http.jdk.JdkHttpClient execute0
FINE: Ending request (POST) /session in 3,099ms
May 02, 2024 9:54:07 AM org.openqa.selenium.remote.ProtocolHandshake createSession
FINE: Detected upstream dialect: W3C
May 02, 2024 9:54:07 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executed: newSession Capabilities {acceptInsecureCerts: false, browserName: firefox, browserVersion: 124.0.2, moz:accessibilityChecks: false, moz:buildID: 20240401114208, moz:debuggerAddress: 127.0.0.1:8114, moz:geckodriverVersion: 0.34.0, moz:headless: false, moz:platformVersion: 23.4.0, moz:processID: 95364, moz:profile: /var/folders/8r/r9sbb49x53l..., moz:shutdownTimeout: 60000, moz:webdriverClick: true, moz:windowless: false, pageLoadStrategy: normal, platformName: mac, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 1000, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
May 02, 2024 9:54:07 AM org.openqa.selenium.devtools.CdpEndpointFinder getReportedUri
FINE: URI found: http://127.0.0.1:8114
May 02, 2024 9:54:07 AM org.openqa.selenium.remote.http.jdk.JdkHttpClient execute0
FINE: Executing request: (GET) /json/version
FINE: [main] [3s 498ms] HttpClientImpl(2) ClientImpl (async) send http://127.0.0.1:8114/json/version GET
May 02, 2024 9:54:07 AM jdk.internal.net.http.Exchange establishExchange
FINE: [JdkHttpClient-1-0] [3s 499ms] Exchange establishing exchange for http://127.0.0.1:8114/json/version GET,
         proxy=null
May 02, 2024 9:54:07 AM org.openqa.selenium.remote.http.jdk.JdkHttpClient execute0
FINE: Ending request (GET) /json/version in 36ms
May 02, 2024 9:54:07 AM jdk.internal.net.http.Http1Exchange lambda$sendHeadersAsync$3
FINE: [JdkHttpClient-1-1] [3s 534ms] Http1Exchange asyncReceiver finished (failed=java.io.EOFException: EOF reached while reading)
org.openqa.selenium.bidi.BiDiException: This version of Firefox or geckodriver does not support Bidi
May 02, 2024 9:54:07 AM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
FINE: Found exact CDP implementation for version 85
May 02, 2024 9:54:07 AM org.openqa.selenium.remote.http.jdk.JdkHttpClient$4 close
FINE: Closing websocket
May 02, 2024 9:54:07 AM org.openqa.selenium.remote.http.jdk.JdkHttpClient$4 send
FINE: Sending close message, statusCode 1,000, reason: WebDriver closing socket
May 02, 2024 9:54:07 AM org.openqa.selenium.remote.http.jdk.JdkHttpClient$4 send
FINE: Websocket response to org.openqa.selenium.remote.http.CloseMessage@600b90df read in 13ms
May 02, 2024 9:54:07 AM org.openqa.selenium.remote.http.jdk.JdkHttpClient$4 close
FINE: Closing websocket
May 02, 2024 9:54:07 AM jdk.internal.net.http.websocket.MessageDecoder endFrame
FINE: [HttpClient-3-SelectorManager] [3s 665ms] [Input] end frame
May 02, 2024 9:54:07 AM org.openqa.selenium.remote.http.jdk.JdkHttpClient$4 send
FINE: Output is closed, not sending close message
May 02, 2024 9:54:07 AM jdk.internal.net.http.websocket.WebSocketImpl signalError

=======================================
Firefox logs (says BiDi is operational)
=======================================

1714623844446	geckodriver	INFO	Listening on 127.0.0.1:19933
1714623844560	webdriver::server	DEBUG	-> POST /session {
  "capabilities": {
    "firstMatch": [
      {
        "acceptInsecureCerts": false,
        "browserName": "firefox",
        "moz:debuggerAddress": true,
        "moz:firefoxOptions": {
          "binary": "\u002fApplications\u002fFirefox.app\u002fContents\u002fMacOS\u002ffirefox"
        },
        "timeouts": {
          "implicit": 1000
        }
      }
    ]
  }
}
1714623844560	geckodriver::capabilities	DEBUG	Trying to read firefox version from ini files
1714623844562	geckodriver::capabilities	DEBUG	Found version 124.0.2
1714623844569	mozrunner::runner	INFO	Running command: MOZ_CRASHREPORTER="1" MOZ_CRASHREPORTER_NO_REPORT="1" MOZ_CRASHREPORTER_SHUTDOWN="1" MOZ_NO_REMOTE="1" "/Applications/Firefox.app/Contents/MacOS/firefox" "--marionette" "--remote-debugging-port" "8114" "--remote-allow-hosts" "localhost" "--remote-allow-origins" "http://127.0.0.1:8114/,http://localhost:8114/,http://[::1]:8114/" "-foreground" "-no-remote" "-profile" "/var/folders/8r/r9sbb49x53l3r2_s862p20v80000gs/T/rust_mozprofile2idGKJ"
1714623844571	geckodriver::marionette	DEBUG	Waiting 60s to connect to browser on 127.0.0.1
console.warn: services.settings: Ignoring preference override of remote settings server
console.warn: services.settings: Allow by setting MOZ_REMOTE_SETTINGS_DEVTOOLS=1 in the environment
1714623845238	RemoteAgent	DEBUG	WebDriver BiDi enabled
1714623845239	RemoteAgent	DEBUG	CDP enabled
1714623845239	Marionette	INFO	Marionette enabled
1714623845239	RemoteAgent	DEBUG	Setting recommended pref apz.content_response_timeout to 60000
1714623845239	RemoteAgent	DEBUG	Setting recommended pref browser.contentblocking.introCount to 99
1714623845239	RemoteAgent	DEBUG	Setting recommended pref browser.download.panel.shown to true
1714623845239	RemoteAgent	DEBUG	Setting recommended pref browser.newtabpage.activity-stream.showSponsoredTopSites to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.newtabpage.enabled to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.pagethumbnails.capturing_disabled to true
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.region.network.url to 
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.safebrowsing.blockedURIs.enabled to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.safebrowsing.downloads.enabled to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.safebrowsing.malware.enabled to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.safebrowsing.phishing.enabled to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.search.update to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.startup.couldRestoreSession.count to -1
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.tabs.unloadOnLowMemory to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.tabs.warnOnClose to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.tabs.warnOnCloseOtherTabs to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.tabs.warnOnOpen to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.toolbars.bookmarks.visibility to never
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.topsites.contile.enabled to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.usedOnWindows10.introURL to 
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.urlbar.merino.endpointURL to 
1714623845240	RemoteAgent	DEBUG	Setting recommended pref browser.urlbar.suggest.searches to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref datareporting.policy.dataSubmissionPolicyAccepted to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref dom.disable_open_during_load to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref dom.file.createInChild to true
1714623845240	RemoteAgent	DEBUG	Setting recommended pref dom.input_events.security.minNumTicks to 0
1714623845240	RemoteAgent	DEBUG	Setting recommended pref dom.input_events.security.minTimeElapsedInMS to 0
1714623845240	RemoteAgent	DEBUG	Setting recommended pref dom.max_chrome_script_run_time to 0
1714623845240	RemoteAgent	DEBUG	Setting recommended pref dom.max_script_run_time to 0
1714623845240	RemoteAgent	DEBUG	Setting recommended pref dom.navigation.locationChangeRateLimit.count to 0
1714623845240	RemoteAgent	DEBUG	Setting recommended pref dom.push.connection.enabled to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref dom.screenorientation.allow-lock to true
1714623845240	RemoteAgent	DEBUG	Setting recommended pref dom.successive_dialog_time_limit to 0
1714623845240	RemoteAgent	DEBUG	Setting recommended pref extensions.getAddons.cache.enabled to false
1714623845240	RemoteAgent	DEBUG	Setting recommended pref extensions.getAddons.discovery.api_url to data:, 
1714623845240	RemoteAgent	DEBUG	Setting recommended pref extensions.blocklist.detailsURL to http://%(server)s/extensions-dummy/blocklistDetailsURL
1714623845240	RemoteAgent	DEBUG	Setting recommended pref extensions.blocklist.itemURL to http://%(server)s/extensions-dummy/blocklistItemURL
1714623845240	RemoteAgent	DEBUG	Setting recommended pref extensions.hotfix.url to http://%(server)s/extensions-dummy/hotfixURL
1714623845240	RemoteAgent	DEBUG	Setting recommended pref extensions.systemAddon.update.url to http://%(server)s/dummy-system-addons.xml
1714623845241	RemoteAgent	DEBUG	Setting recommended pref extensions.update.background.url to http://%(server)s/extensions-dummy/updateBackgroundURL
1714623845241	RemoteAgent	DEBUG	Setting recommended pref extensions.update.url to http://%(server)s/extensions-dummy/updateURL
1714623845241	RemoteAgent	DEBUG	Setting recommended pref extensions.getAddons.get.url to http://%(server)s/extensions-dummy/repositoryGetURL
1714623845241	RemoteAgent	DEBUG	Setting recommended pref extensions.getAddons.search.browseURL to http://%(server)s/extensions-dummy/repositoryBrowseURL
1714623845241	RemoteAgent	DEBUG	Setting recommended pref geo.provider.network.url to 
1714623845241	RemoteAgent	DEBUG	Setting recommended pref identity.fxaccounts.auth.uri to https://{server}/dummy/fxa
1714623845241	RemoteAgent	DEBUG	Setting recommended pref network.connectivity-service.enabled to false
1714623845241	RemoteAgent	DEBUG	Setting recommended pref network.http.phishy-userpass-length to 255
1714623845241	RemoteAgent	DEBUG	Setting recommended pref network.http.prompt-temp-redirect to false
1714623845241	RemoteAgent	DEBUG	Setting recommended pref privacy.trackingprotection.enabled to false
1714623845241	RemoteAgent	DEBUG	Setting recommended pref security.fileuri.strict_origin_policy to false
1714623845241	RemoteAgent	DEBUG	Setting recommended pref security.notification_enable_delay to 0
1714623845241	RemoteAgent	DEBUG	Setting recommended pref security.remote_settings.intermediates.enabled to false
1714623845241	RemoteAgent	DEBUG	Setting recommended pref signon.autofillForms to false
1714623845241	RemoteAgent	DEBUG	Setting recommended pref signon.rememberSignons to false
1714623845241	RemoteAgent	DEBUG	Setting recommended pref toolkit.telemetry.server to https://%(server)s/telemetry-dummy/
1714623845241	RemoteAgent	DEBUG	Setting recommended pref widget.windows.window_occlusion_tracking.enabled to false
console.error: "Warning: unrecognized command line flag" "-remote-allow-hosts"
console.error: "Warning: unrecognized command line flag" "-remote-allow-origins"
1714623845603	Marionette	INFO	Listening on port 55398
1714623845603	Marionette	DEBUG	Marionette is listening
WebDriver BiDi listening on ws://127.0.0.1:8114
1714623845614	RemoteAgent	DEBUG	Setting recommended pref browser.contentblocking.features.standard to -tp,tpPrivate,cookieBehavior0,-cm,-fp
1714623845614	RemoteAgent	DEBUG	Setting recommended pref network.cookie.cookieBehavior to 0
1714623845615	CDP	DEBUG	Waiting for initial application window
Read port: 55398
1714623845738	Marionette	DEBUG	Accepted connection 0 from 127.0.0.1:55399
1714623845742	geckodriver::marionette	DEBUG	Connection to Marionette established on 127.0.0.1:55398.
1714623845859	Marionette	DEBUG	0 -> [0,1,"WebDriver:NewSession",{"acceptInsecureCerts":false,"browserName":"firefox","timeouts":{"implicit":1000}}]
1714623845861	Marionette	DEBUG	Waiting for initial application window
DevTools listening on ws://127.0.0.1:8114/devtools/browser/3c8cce73-4b37-4dfc-859e-e2247e216aa4
1714623847518	Marionette	DEBUG	0 <- [1,1,null,{"sessionId":"5f76d141-80a9-4c1c-bd72-d245b4d82b36","capabilities":{"browserName":"firefox","browserVersion":"124.0.2","platformName":"mac","acceptInsecureCerts":false,"pageLoadStrategy":"normal","setWindowRect":true,"timeouts":{"implicit":1000,"pageLoad":300000,"script":30000},"strictFileInteractability":false,"unhandledPromptBehavior":"dismiss and notify","moz:accessibilityChecks":false,"moz:buildID":"20240401114208","moz:debuggerAddress":"127.0.0.1:8114","moz:headless":false,"moz:platformVersion":"23.4.0","moz:processID":95364,"moz:profile":"/var/folders/8r/r9sbb49x53l3r2_s862p20v80000gs/T/rust_mozprofile2idGKJ","moz:shutdownTimeout":60000,"moz:webdriverClick":true,"moz:windowless":false,"proxy":{}}}]
1714623847521	webdriver::server	DEBUG	<- 200 OK {"value":{"sessionId":"5f76d141-80a9-4c1c-bd72-d245b4d82b36","capabilities":{"acceptInsecureCerts":false,"browserName":"firefox","browserVersion":"124.0.2","moz:accessibilityChecks":false,"moz:buildID":"20240401114208","moz:debuggerAddress":"127.0.0.1:8114","moz:geckodriverVersion":"0.34.0","moz:headless":false,"moz:platformVersion":"23.4.0","moz:processID":95364,"moz:profile":"/var/folders/8r/r9sbb49x53l3r2_s862p20v80000gs/T/rust_mozprofile2idGKJ","moz:shutdownTimeout":60000,"moz:webdriverClick":true,"moz:windowless":false,"pageLoadStrategy":"normal","platformName":"mac","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":1000,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify"}}}
1714623847715	RemoteAgent	INFO	Perform WebSocket upgrade for incoming connection from 127.0.0.1:55417
1714623847717	RemoteAgent	DEBUG	CDPConnection 89c31542-7ee3-4113-b4bf-271b90d6d5ac accepted
1714623847718	CDP	WARN	Invalid browser preferences for CDP. Set "fission.webContentIsolationStrategy"to 0 and "fission.bfcacheInParent" to false before Firefox starts.
1714623847790	RemoteAgent	DEBUG	CDPConnection 89c31542-7ee3-4113-b4bf-271b90d6d5ac closed
1714623847809	webdriver::server	DEBUG	-> DELETE /session/5f76d141-80a9-4c1c-bd72-d245b4d82b36 
1714623847810	Marionette	DEBUG	0 -> [0,2,"Marionette:Quit",{"flags":["eForceQuit"]}]
1714623847811	Marionette	INFO	Stopped listening on port 55398
1714623848214	RemoteAgent	DEBUG	Resetting recommended pref apz.content_response_timeout
1714623848214	RemoteAgent	DEBUG	Resetting recommended pref browser.contentblocking.introCount
1714623848215	RemoteAgent	DEBUG	Resetting recommended pref browser.download.panel.shown
1714623848215	RemoteAgent	DEBUG	Resetting recommended pref browser.newtabpage.activity-stream.showSponsoredTopSites
1714623848215	RemoteAgent	DEBUG	Resetting recommended pref browser.newtabpage.enabled
1714623848216	RemoteAgent	DEBUG	Resetting recommended pref browser.pagethumbnails.capturing_disabled
1714623848216	RemoteAgent	DEBUG	Resetting recommended pref browser.region.network.url
1714623848216	RemoteAgent	DEBUG	Resetting recommended pref browser.safebrowsing.blockedURIs.enabled
1714623848218	RemoteAgent	DEBUG	Resetting recommended pref browser.safebrowsing.downloads.enabled
1714623848220	RemoteAgent	DEBUG	Resetting recommended pref browser.safebrowsing.malware.enabled
1714623848222	RemoteAgent	DEBUG	Resetting recommended pref browser.safebrowsing.phishing.enabled
1714623848223	RemoteAgent	DEBUG	Resetting recommended pref browser.search.update
1714623848223	RemoteAgent	DEBUG	Resetting recommended pref browser.startup.couldRestoreSession.count
1714623848223	RemoteAgent	DEBUG	Resetting recommended pref browser.tabs.unloadOnLowMemory
1714623848223	RemoteAgent	DEBUG	Resetting recommended pref browser.tabs.warnOnClose
1714623848223	RemoteAgent	DEBUG	Resetting recommended pref browser.tabs.warnOnCloseOtherTabs
1714623848223	RemoteAgent	DEBUG	Resetting recommended pref browser.tabs.warnOnOpen
1714623848224	RemoteAgent	DEBUG	Resetting recommended pref browser.toolbars.bookmarks.visibility
1714623848224	RemoteAgent	DEBUG	Resetting recommended pref browser.topsites.contile.enabled
1714623848224	RemoteAgent	DEBUG	Resetting recommended pref browser.usedOnWindows10.introURL
1714623848224	RemoteAgent	DEBUG	Resetting recommended pref browser.urlbar.merino.endpointURL
1714623848225	RemoteAgent	DEBUG	Resetting recommended pref browser.urlbar.suggest.searches
1714623848226	RemoteAgent	DEBUG	Resetting recommended pref datareporting.policy.dataSubmissionPolicyAccepted
1714623848226	RemoteAgent	DEBUG	Resetting recommended pref dom.disable_open_during_load
1714623848226	RemoteAgent	DEBUG	Resetting recommended pref dom.file.createInChild
1714623848226	RemoteAgent	DEBUG	Resetting recommended pref dom.input_events.security.minNumTicks
1714623848227	RemoteAgent	DEBUG	Resetting recommended pref dom.input_events.security.minTimeElapsedInMS
1714623848227	RemoteAgent	DEBUG	Resetting recommended pref dom.max_chrome_script_run_time
1714623848227	RemoteAgent	DEBUG	Resetting recommended pref dom.max_script_run_time
1714623848227	RemoteAgent	DEBUG	Resetting recommended pref dom.navigation.locationChangeRateLimit.count
1714623848227	RemoteAgent	DEBUG	Resetting recommended pref dom.push.connection.enabled
1714623848227	RemoteAgent	DEBUG	Resetting recommended pref dom.screenorientation.allow-lock
1714623848227	RemoteAgent	DEBUG	Resetting recommended pref dom.successive_dialog_time_limit
1714623848228	RemoteAgent	DEBUG	Resetting recommended pref extensions.getAddons.cache.enabled
1714623848228	RemoteAgent	DEBUG	Resetting recommended pref extensions.getAddons.discovery.api_url
1714623848228	RemoteAgent	DEBUG	Resetting recommended pref extensions.blocklist.detailsURL
1714623848228	RemoteAgent	DEBUG	Resetting recommended pref extensions.blocklist.itemURL
1714623848228	RemoteAgent	DEBUG	Resetting recommended pref extensions.hotfix.url
1714623848228	RemoteAgent	DEBUG	Resetting recommended pref extensions.systemAddon.update.url
1714623848228	RemoteAgent	DEBUG	Resetting recommended pref extensions.update.background.url
1714623848229	RemoteAgent	DEBUG	Resetting recommended pref extensions.update.url
1714623848229	RemoteAgent	DEBUG	Resetting recommended pref extensions.getAddons.get.url
1714623848229	RemoteAgent	DEBUG	Resetting recommended pref extensions.getAddons.search.browseURL
1714623848229	RemoteAgent	DEBUG	Resetting recommended pref geo.provider.network.url
1714623848229	RemoteAgent	DEBUG	Resetting recommended pref identity.fxaccounts.auth.uri
1714623848229	RemoteAgent	DEBUG	Resetting recommended pref network.connectivity-service.enabled
1714623848229	RemoteAgent	DEBUG	Resetting recommended pref network.http.phishy-userpass-length
1714623848229	RemoteAgent	DEBUG	Resetting recommended pref network.http.prompt-temp-redirect
1714623848229	RemoteAgent	DEBUG	Resetting recommended pref privacy.trackingprotection.enabled
1714623848229	RemoteAgent	DEBUG	Resetting recommended pref security.fileuri.strict_origin_policy
1714623848230	RemoteAgent	DEBUG	Resetting recommended pref security.notification_enable_delay
1714623848230	RemoteAgent	DEBUG	Resetting recommended pref security.remote_settings.intermediates.enabled
1714623848230	RemoteAgent	DEBUG	Resetting recommended pref signon.autofillForms
1714623848230	RemoteAgent	DEBUG	Resetting recommended pref signon.rememberSignons
1714623848231	RemoteAgent	DEBUG	Resetting recommended pref toolkit.telemetry.server
1714623848231	RemoteAgent	DEBUG	Resetting recommended pref widget.windows.window_occlusion_tracking.enabled
1714623848231	RemoteAgent	DEBUG	Resetting recommended pref browser.contentblocking.features.standard
1714623848231	RemoteAgent	DEBUG	Resetting recommended pref network.cookie.cookieBehavior
1714623848233	Marionette	DEBUG	Marionette stopped listening
1714623848233	Marionette	DEBUG	0 <- [1,2,null,{"cause":"shutdown","forced":false,"in_app":true}]
1714623848275	RemoteAgent	DEBUG	Resetting recommended pref browser.contentblocking.features.standard
1714623848275	RemoteAgent	DEBUG	Resetting recommended pref network.cookie.cookieBehavior
1714623848276	webdriver::server	DEBUG	Teardown session
1714623848283	Marionette	DEBUG	Closed connection 0
1714623848484	geckodriver::browser	DEBUG	Browser process stopped: exit status: 0
1714623848530	webdriver::server	DEBUG	<- 200 OK {"value":null}

Operating System

macOS Sonoma | Amazon Linux 2

Selenium version

Java 4.20.0

What are the browser(s) and version(s) where you see this issue?

Firefox 124.0.2 | Chrome 124.0.6367.93

What are the browser driver(s) and version(s) where you see this issue?

GeckoDriver 0.34.0 | ChromeDriver 124.0.6367.91

Are you using Selenium Grid?

No

Copy link

github-actions bot commented May 2, 2024

@DashwoodIce9, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@DashwoodIce9 DashwoodIce9 changed the title [🐛 Bug]: BiDi is not working [🐛 Bug]: BiDi is not working (Firefox/Chrome) May 2, 2024
@pujagani
Copy link
Contributor

pujagani commented May 2, 2024

Hello! Thank you for sharing the details. Please ensure that the "websocketurl" capability is set to true.

Example:

  FirefoxOptions options = new FirefoxOptions();
  options.setCapability("webSocketUrl", true);

The code example shared does not have this capability set. Hence, you are getting the error mentioned.
Please refer to code examples here.

@pujagani pujagani closed this as completed May 2, 2024
diemol added a commit that referenced this issue May 2, 2024
Either when `webSocketUrl` is not set or the
browser version does not support BiDi.

Related to #13896

[skip ci]
@diemol
Copy link
Member

diemol commented May 2, 2024

I've seen a few issues raised due to the same problem. I pushed a small change that improved the error message.

@pujagani
Copy link
Contributor

pujagani commented May 2, 2024

Ahh okay. Thank you, Diego!

Copy link

github-actions bot commented Jun 1, 2024

This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants