Skip to content

[πŸ› Bug]: (Java) Launching Browser in Incognito Mode with BiDi Enabled is causing start-up failuresΒ #15171

@MustafaAgamy

Description

@MustafaAgamy

What happened?

When using Selenium WebDriver with the WebDriver BiDi protocol enabled, launching Chrome in incognito mode results in a startup failure.
The browser fails to open a new tab, and the WebDriver session cannot be established.
The issue occurs consistently when the --incognito argument is passed to ChromeOptions while enabling BiDi.

Please note I captured the logs using Selenium Logger

Issue Video Link

Please note that the Exception is thrown at this code block which is class "JdkHttpClient", Hope this helps.

Image

How can we reproduce the issue?

@Test
    public void testIncognitoWithBiDi() {
        ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.setCapability("webSocketUrl", true);
        chromeOptions.addArguments("--incognito");

        WebDriver driver = new ChromeDriver(chromeOptions);
    }

Relevant log output

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2025-01-27 20:15:55 FINE Selenium [SeleniumManager getBinary] Selenium Manager binary found at: C:\Users\Agami\.cache\selenium\manager\0.4.28\selenium-manager.exe 
2025-01-27 20:15:55 FINE Selenium [SeleniumManager runCommand] Executing Process: [--browser, chrome, --language-binding, java, --output, json, --debug] 
2025-01-27 20:15:56 FINE Selenium [ExternalProcess] completed to copy the output of process 3256 
2025-01-27 20:15:56 FINE Selenium [SeleniumManager] chromedriver not found in PATH 
2025-01-27 20:15:56 FINE Selenium [SeleniumManager] chrome detected at C:\Program Files\Google\Chrome\Application\chrome.exe 
2025-01-27 20:15:56 FINE Selenium [SeleniumManager] Running command: wmic datafile where name='C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe' get Version /value 
2025-01-27 20:15:56 FINE Selenium [SeleniumManager] Output: "\r\r\n\r\r\nVersion=131.0.6778.265\r\r\n\r\r\n\r\r\n\r" 
2025-01-27 20:15:56 FINE Selenium [SeleniumManager] Detected browser: chrome 131.0.6778.265 
2025-01-27 20:15:56 FINE Selenium [SeleniumManager] Required driver: chromedriver 131.0.6778.264 
2025-01-27 20:15:56 FINE Selenium [SeleniumManager] chromedriver 131.0.6778.264 already in the cache 
2025-01-27 20:15:56 FINE Selenium [SeleniumManager] Driver path: C:\Users\Agami\.cache\selenium\chromedriver\win64\131.0.6778.264\chromedriver.exe 
2025-01-27 20:15:56 FINE Selenium [SeleniumManager] Browser path: C:\Program Files\Google\Chrome\Application\chrome.exe 
2025-01-27 20:15:56 FINE Selenium [RemoteWebDriver] Executing: newSession [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [--incognito], binary: C:\Program Files\Google\Chr..., extensions: []}, webSocketUrl: true}]}] 
2025-01-27 20:15:56 FINE Selenium [DriverService start] Starting driver at C:\Users\Agami\.cache\selenium\chromedriver\win64\131.0.6778.264\chromedriver.exe with [--port=33018] 
2025-01-27 20:15:56 FINE Selenium [UrlChecker waitUntilAvailable] Waiting for [http://localhost:33018/status] 
2025-01-27 20:15:56 FINE Selenium [UrlChecker] Polling http://localhost:33018/status 
2025-01-27 20:15:56 FINE Selenium [UrlChecker] Polling http://localhost:33018/status 
2025-01-27 20:15:56 FINE Selenium [UrlChecker] Polling http://localhost:33018/status 
2025-01-27 20:15:56 FINE Selenium [JdkHttpClient execute0] Executing request: (POST) /session 
2025-01-27 20:15:57 FINE Selenium [JdkHttpClient execute0] Ending request (POST) /session in 856ms 
2025-01-27 20:15:57 FINE Selenium [UrlChecker waitUntilUnavailable] Waiting for http://localhost:33018/shutdown 
2025-01-27 20:15:57 FINE Selenium [UrlChecker] Polling http://localhost:33018/shutdown 
2025-01-27 20:15:57 FINE Selenium [ExternalProcess] completed to copy the output of process 18404 
2025-01-27 20:15:57 FINE Selenium [UrlChecker] Polling http://localhost:33018/shutdown 
2025-01-27 20:15:57 FINE Selenium [RemoteWebDriver] Exception: newSession Could not start a new session. Response code 500. Message: unknown error: unhandled inspector error: {"code":-32000,"message":"Failed to open new tab - no browser is open"}
  (Session info: chrome=131.0.6778.265) 
Host info: host: 'DESKTOP-M0F1IJA', ip: '192.168.1.7'
Build info: version: '4.28.1', revision: '73f5ad48a2'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '21.0.1'
Driver info: driver.version: ChromeDriver 

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: unhandled inspector error: {"code":-32000,"message":"Failed to open new tab - no browser is open"}
  (Session info: chrome=131.0.6778.265) 
Host info: host: 'DESKTOP-M0F1IJA', ip: '192.168.1.7'
Build info: version: '4.28.1', revision: '73f5ad48a2'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '21.0.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [--incognito], binary: C:\Program Files\Google\Chr..., extensions: []}, webSocketUrl: true}]}]

	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:114)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:75)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:61)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:187)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:216)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:174)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:245)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:174)
	at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:114)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:88)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:83)
	at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:72)
	at TestChrome.beforeMethodSetup(TestChrome.java:25)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:141)
	at org.testng.internal.invokers.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:71)
	at org.testng.internal.invokers.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:400)
	at org.testng.internal.invokers.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:333)
	at org.testng.internal.invokers.TestInvoker.runConfigMethods(TestInvoker.java:833)
	at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:600)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:230)
	at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:63)
	at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:992)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:203)
	at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:154)
	at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:134)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at org.testng.TestRunner.privateRun(TestRunner.java:739)
	at org.testng.TestRunner.run(TestRunner.java:614)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:421)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:413)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:373)
	at org.testng.SuiteRunner.run(SuiteRunner.java:312)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1274)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1208)
	at org.testng.TestNG.runSuites(TestNG.java:1112)
	at org.testng.TestNG.run(TestNG.java:1079)
	at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:65)
	at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:105)

Operating System

Windows 10

Selenium version

4.28.1

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

Chrome 131.0.6778.265

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

Any Driver

Are you using Selenium Grid?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!I-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions