selenoid: Cannot create devtools session in selenoid using selenium 4

Hello. Tried to create devtools session with remote web driver but got error

java.lang.ClassCastException: class org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$oDUeXh8L cannot be cast to class org.openqa.selenium.devtools.HasDevTools (org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$oDUeXh8L is in unnamed module of loader net.bytebuddy.dynamic.loading.ByteArrayClassLoader @bf59c9c; org.openqa.selenium.devtools.HasDevTools is in unnamed module of loader 'app')

Used this way to get devtools:

WebDriver driver = new Augmenter().augment(new RemoteWebDriver(new URL(SELENOID_URL_HUB), getChromeOptions()));
        DevTools devTools = ((HasDevTools) driver).getDevTools();
        devTools.createSession();

Also I use bytebuddy for Augmenter:

<dependency>
    <groupId>net.bytebuddy</groupId>
    <artifactId>byte-buddy</artifactId>
    <version>1.12.4</version>
</dependency>

Created repository with simple project to demonstrate this: https://github.com/hellfish46/SeleniumIssue

This way to creation of devtools session works locally. When I used selenium grid standalone I didn’t get this error, but got another error with socket connection (doesn’t matter=) )

Maybe I do something wrong.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 18 (8 by maintainers)

Most upvoted comments

@bonigarcia se:cdp and se:version capabilities required by Selenium client to establish a CDP connection are never returned by web driver binaries. So trying to execute this code against browser image directly will never work. Selenium and Selenoid are adding these capabilities manually to new session response once it’s created.