selenium: [๐ Bug]: networkConnectionEnabled capability chromeOptions does not work anymore with Selenium 4.9.0.
What happened?
The newest version of Selinium is not supporting anymore to setup networkConnectionEnabled true:
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setCapability("networkConnectionEnabled", true);
Causing this:
Caused by: java.lang.IllegalArgumentException: Illegal key values seen in w3c capabilities: [networkConnectionEnabled]
This was used for mobile testing.
How can we reproduce the issue?
With updating the following dependency:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>4.8.3</version>
</dependency>
To:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>4.9.0</version>
</dependency>
And using the remoteWebDriver like this:
ChromeOptions chromeOptions = new ChromeOptions();
URL remoteURL = // generate some remote URL
driver = new RemoteWebDriver(remoteURL, chromeOptions);
Will generate the exception.
### Relevant log output
```shell
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [--remote-allow-origins=*, --headless, --disable-gpu], extensions: [], mobileEmulation: {deviceName: Laptop with touch}}, networkConnectionEnabled: true}]}]
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:561)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:229)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:157)
at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:101)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:88)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:84)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:73)
at com.vaadin.flow.testutil.ChromeDeviceTest.setup(ChromeDeviceTest.java:83)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.RunBefores.invokeMethod(RunBefores.java:33)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at com.vaadin.testbench.parallel.ParallelRunner$1.evaluate(ParallelRunner.java:465)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:345)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalArgumentException: Illegal key values seen in w3c capabilities: [networkConnectionEnabled]
at org.openqa.selenium.remote.NewSessionPayload.lambda$validate$4(NewSessionPayload.java:175)
at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:540)
at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:541)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:541)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at org.openqa.selenium.remote.NewSessionPayload.validate(NewSessionPayload.java:179)
at org.openqa.selenium.remote.NewSessionPayload.<init>(NewSessionPayload.java:91)
at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:124)
at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:112)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:165)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:183)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
... 31 more
### Operating System
macOS Monterey
### Selenium version
Selenium Java 4.9.0
### What are the browser(s) and version(s) where you see this issue?
Chrome 112.0.5615.49
### What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 4.9.0
### Are you using Selenium Grid?
_No response_
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17 (6 by maintainers)
4.9 only supports CDP for
v110, v111, and v112. Please update your chrome version and any references to the old version in your code. Updating versions is a pain and weโre actively working to implement these things with a cross-browser WebDriver-BiDi protocol. The Network module was just adde to the spec, so hopefully weโll have future compatible code available soon.Oh interesting, thanks for sharing that; Iโm not very familiar with the mobile package.
Hmm, it doesnโt show up as required in their docs - https://chromedriver.chromium.org/mobile-emulation Maybe it used to be and isnโt now? /shrug