question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[🐛 Bug]: Using WebDriverListener with Augmenter throws ArgumentException

See original GitHub issue

What happened?

Getting error in case of RemoteWebDriver using WebDriverListener.

How can we reproduce the issue?

Project: Maven
Runner: TestNG

src/main/java folder:

public class Driver {
    public static void initDriver() {
        assertionMode = AssertionMode.SOFT;
        baseUrl = "https://www.google.com/";
        pageLoadStrategy = "eager";
        browser = "Chrome";
        pollingInterval = 500;
        holdBrowserOpen = false;
        savePageSource = false;
        fastSetValue = true;
        screenshots = false;
        remote = "remoteMachineUrl";
        driverManagerEnabled = true;
        headless = false;
        timeout = 10000;
        WebDriverRunner.addListener(new WebDriverEvent());
        open();
    }


public final class Util {
    public static WebDriver driver = new Augmenter().augment(getWebDriver());
    public static DevTools devTools = ((HasDevTools) driver).getDevTools();
}


public class WebDriverEvent implements WebDriverListener {
    @Override
    public void beforeClick(WebElement element) {
        WebDriverListener.super.beforeClick(element);
        System.out.println("Before Click");
    }
}

src/test/java folder:

public class DevToolsTest {
    @Test
    public void devToolTest(){
        Driver.initDriver();
        open(baseUrl);
        Util.devTools.createSession();
        Util.devTools.send(Network.clearBrowserCache());
    }
}


pom XML:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>Draft</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.4.0</version>
        </dependency>
        <dependency>
            <groupId>com.codeborne</groupId>
            <artifactId>selenide</artifactId>
            <version>6.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.selenide</groupId>
            <artifactId>selenide-testng</artifactId>
            <version>1.0.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.bytebuddy</groupId>
            <artifactId>byte-buddy</artifactId>
            <version>1.12.6</version>
        </dependency>
    </dependencies>
</project>


The problem is connected with the WebDriverListener interface, when I remove this everything is okay.
But the problem is only arising in the case of running the test on the remote machine, when I run the test with the WebDriverListener interface in the local machine, everything is okay.

Relevant log output

java.lang.ExceptionInInitializerError
	at DevToolsTest.devToolTest(DevToolsTest.java:13)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
	at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:598)
	at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
	at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
	at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:824)
	at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.testng.TestRunner.privateRun(TestRunner.java:794)
	at org.testng.TestRunner.run(TestRunner.java:596)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:377)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:371)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:332)
	at org.testng.SuiteRunner.run(SuiteRunner.java:276)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1212)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1134)
	at org.testng.TestNG.runSuites(TestNG.java:1063)
	at org.testng.TestNG.run(TestNG.java:1031)
	at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
	at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)
Caused by: java.lang.IllegalArgumentException: Cannot subclass primitive, array or final types: class jdk.proxy2.$Proxy10
	at net.bytebuddy.ByteBuddy.subclass(ByteBuddy.java:490)
	at net.bytebuddy.ByteBuddy.subclass(ByteBuddy.java:463)
	at net.bytebuddy.ByteBuddy.subclass(ByteBuddy.java:360)
	at org.openqa.selenium.remote.Augmenter.augment(Augmenter.java:179)
	at Util.<clinit>(Util.java:10)

Operating System

Local: macOS Monterey / Remote: Windows 10

Selenium version

JavaSE 14: version 16.0.1

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

Chrome 96

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

ChromeDriver 96.0.4664.45

Are you using Selenium Grid?

Selenium Grid (selenium server 4.1.0)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
pujaganicommented, Feb 8, 2022

Thank you for checking with the latest version and confirming that!

1reaction
arsen-papoyancommented, Feb 7, 2022

It finally worked, thanks for your support.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found