[🐛 Bug]: org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$RwtMl7Wf cannot be cast to org.openqa.selenium.devtools.HasDevTools
See original GitHub issueWhat happened?
I am running latest selenium-docker image:
sudo docker run -d -p 4444:4444 --shm-size="2g" -e SCREEN_WIDTH=1280 -e SCREEN_HEIGHT=720 selenium/standalone-chrome:4.1.0-20211209
In my Java application I have the following code snippet that throws ClassCastException:
ChromeOptions options = new ChromeOptions();
String driverUrl = "http://127.0.0.1:4444/wd/hub";
WebDriver driver = new RemoteWebDriver(new URL(driverUrl), options);
driver = new Augmenter().augment(driver);
DevTools devTools = ((HasDevTools) driver).getDevTools();
devTools.createSession();
As soon as the HasDevTools
cast is attempted, I am getting:
org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$RwtMl7Wf cannot be cast to org.openqa.selenium.devtools.HasDevTools: java.lang.ClassCastException: org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$RwtMl7Wf cannot be cast to org.openqa.selenium.devtools.HasDevTools
I have carefully reviewed all the similar issues, but none of them seems to have concluded on this particular bug.
My relevant grade dependency is:
implementation 'org.seleniumhq.selenium:selenium-java:4.1.0'
implementation 'org.seleniumhq.selenium:selenium-devtools-v94:4.1.0'
My JDK is:
OS Version: 4.14.252-195.483.amzn2.x86_64 Java Name: OpenJDK 64-Bit Server VM Java Vendor: Oracle Corporation Java Version: 9.0.4 Java VM Version: 9.0.4+11
How can we reproduce the issue?
ChromeOptions options = new ChromeOptions();
String driverUrl = "http://127.0.0.1:4444/wd/hub";
WebDriver driver = new RemoteWebDriver(new URL(driverUrl), options);
driver = new Augmenter().augment(driver);
DevTools devTools = ((HasDevTools) driver).getDevTools();
devTools.createSession();
Relevant log output
2021-12-10 17:04:26 UTC comment server INFO 200 - Tricky cast _defaultVHost_ - - 30.728 - - - - - - - - - - - - -
- - - - - - - - - - - -
2021-12-10 17:04:26 UTC comment server ERROR 500 - Error initializing stack: org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$RwtMl7Wf cannot be cast to org.openqa.selenium.devtools.HasDevTools: java.lang.ClassCastException: org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$RwtMl7Wf cannot be cast to org.openqa.selenium.devtools.HasDevTools|at com.mycompany.blah.Foo.lambda$new$3(Foo.java:291)|at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)|at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)|at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)|at java.base/java.lang.Thread.run(Unknown Source)| _defaultVHost_ - - 30.73 -
Operating System
Amazon Linux
Selenium version
4.1.0
What are the browser(s) and version(s) where you see this issue?
Chrome
What are the browser driver(s) and version(s) where you see this issue?
the one in your docker image
Are you using Selenium Grid?
4.1.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (6 by maintainers)
Top GitHub Comments
For the people using Maven: You need to use the maven shade plugin (maven assembly won’t work) and configure a
ServicesResourceTransformer
. Heres an example maven shade configuration for an executable uber jar:This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.