What happened?
I am able to use register method from HasAuthentication interface using chromium drivers running on local machine. But when i try to use chromium browser (edge/chrome) which is part of selenium grid I am getting the following error when I try to use HasAuthentication interface.
Code where the test fails:
((HasAuthentication) webDriver).register(() -> new UsernameAndPassword("admin", "admin"));
Error:
java.lang.ClassCastException: class org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$gPlLDnEY cannot be cast to class org.openqa.selenium.HasAuthentication (org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$gPlLDnEY is in unnamed module of loader net.bytebuddy.dynamic.loading.ByteArrayClassLoader @77681ce4; org.openqa.selenium.HasAuthentication is in unnamed module of loader 'app')
How can we reproduce the issue?
How to reproduce the problem:
* Run a selenium grid (standalone / hub&node mode - does not matter)
`java -jar selenium-server.jar standalone --detect-drivers true`
* Execute the code below using selenium-java 4
Code Example
`WebDriver webDriver = RemoteWebDriver
.builder()
.augmentUsing(new Augmenter())
.oneOf(new ChromeOptions())
.address(new URL("http://localhost:4444"))
.build();
((HasAuthentication) webDriver).register(() -> new UsernameAndPassword("admin", "admin"));
webDriver.get("https://the-internet.herokuapp.com/basic_auth");`
Relevant log output
java.lang.ClassCastException: class org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$E2NldVid cannot be cast to class org.openqa.selenium.HasAuthentication (org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$E2NldVid is in unnamed module of loader net.bytebuddy.dynamic.loading.ByteArrayClassLoader @2d38edfd; org.openqa.selenium.HasAuthentication is in unnamed module of loader 'app')
at com.isobar.commerce.selenium.tests.FeaturesTests.test(FeaturesTests.java:175)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
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:1541)
at org.testng.TestRunner.privateRun(TestRunner.java:764)
at org.testng.TestRunner.run(TestRunner.java:585)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
at org.testng.SuiteRunner.run(SuiteRunner.java:286)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.runSuites(TestNG.java:1069)
at org.testng.TestNG.run(TestNG.java:1037)
at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)
Operating System
Windows 10 / MacOS BigSur 11.3.1
Selenium version
4.0.0
What are the browser(s) and version(s) where you see this issue?
Chrome 94
What are the browser driver(s) and version(s) where you see this issue?
chromedriver 94.0.4606.61
Are you using Selenium Grid?
Yes - 4.0.0
What happened?
I am able to use register method from HasAuthentication interface using chromium drivers running on local machine. But when i try to use chromium browser (edge/chrome) which is part of selenium grid I am getting the following error when I try to use HasAuthentication interface.
Code where the test fails:
((HasAuthentication) webDriver).register(() -> new UsernameAndPassword("admin", "admin"));Error:
java.lang.ClassCastException: class org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$gPlLDnEY cannot be cast to class org.openqa.selenium.HasAuthentication (org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$gPlLDnEY is in unnamed module of loader net.bytebuddy.dynamic.loading.ByteArrayClassLoader @77681ce4; org.openqa.selenium.HasAuthentication is in unnamed module of loader 'app')How can we reproduce the issue?
Relevant log output
Operating System
Windows 10 / MacOS BigSur 11.3.1
Selenium version
4.0.0
What are the browser(s) and version(s) where you see this issue?
Chrome 94
What are the browser driver(s) and version(s) where you see this issue?
chromedriver 94.0.4606.61
Are you using Selenium Grid?
Yes - 4.0.0