selenium error unable to connect localhost

593 views
Skip to first unread message

Sooraj

unread,
Mar 15, 2023, 11:06:09 PM3/15/23
to Selenium Users

Exception in thread "main" org.openqa.selenium.remote.http.ConnectionFailedException: Unable to establish websocket connection to http://localhost:57980/devtools/browser/7e6164fd-0a4a-403e-a0b8-7d6449da617f

Build info: version: '4.8.1', revision: '8ebccac989'

System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '19.0.2'

Driver info: driver.version: ChromeDriver

at org.openqa.selenium.remote.http.netty.NettyWebSocket.<init>(NettyWebSocket.java:102)

at org.openqa.selenium.remote.http.netty.NettyWebSocket.lambda$create$3(NettyWebSocket.java:128)

at org.openqa.selenium.remote.http.netty.NettyClient.openSocket(NettyClient.java:107)

at org.openqa.selenium.devtools.Connection.<init>(Connection.java:78)

at org.openqa.selenium.chromium.ChromiumDriver.lambda$new$2(ChromiumDriver.java:116)

at java.base/java.util.Optional.map(Optional.java:260)

at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:114)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:82)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:50)

at Automation.main(Automation.java:9)

ramita sambyal

unread,
Mar 17, 2023, 6:10:12 AM3/17/23
to seleniu...@googlegroups.com, raj....@gmail.com
Hi,
Please use the below code to fix this issue. 

ChromeOptions options= new ChromeOptions();
options.addArguments("--remote-allow-origins=*");


WebDriver driver= new ChromeDriver(options);

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/9a5c5304-0bc5-46d6-a956-d052eacc972cn%40googlegroups.com.

sridharan

unread,
Mar 17, 2023, 6:10:19 AM3/17/23
to Selenium Users
hi ...

based on that use Chromeoptions to resolve it 

copy paste the code 

ChromeOptions options = new ChromeOptions();
options.addArguments(--remote-allow-origins=*);
webDriver driver = new ChromeDriver(options);
driver.getUrl("paste the url ");

venkatesh charla

unread,
Mar 17, 2023, 6:45:23 AM3/17/23
to seleniu...@googlegroups.com
Hi All,

I used run my test cases successfully, But suddenly error started occurring. I am using maven project and page object model java.

Can one of help this error to resolve.

Driver launched successfully

FAILED: MNS_HK_TestCases.Account_TestCases.LoginWithUserNameAndPassword

java.lang.ExceptionInInitializerError

at io.appium.java_client.pagefactory.utils.ProxyFactory.getEnhancedProxy(ProxyFactory.java:53)

at io.appium.java_client.pagefactory.utils.ProxyFactory.getEnhancedProxy(ProxyFactory.java:33)

at io.appium.java_client.pagefactory.AppiumFieldDecorator.proxyForAnElement(AppiumFieldDecorator.java:208)

at io.appium.java_client.pagefactory.AppiumFieldDecorator.access$000(AppiumFieldDecorator.java:60)

at io.appium.java_client.pagefactory.AppiumFieldDecorator$1.proxyForLocator(AppiumFieldDecorator.java:99)

at org.openqa.selenium.support.pagefactory.DefaultFieldDecorator.decorate(DefaultFieldDecorator.java:63)

at io.appium.java_client.pagefactory.AppiumFieldDecorator.decorate(AppiumFieldDecorator.java:146)

at org.openqa.selenium.support.PageFactory.proxyFields(PageFactory.java:111)

at org.openqa.selenium.support.PageFactory.initElements(PageFactory.java:103)

at MNS_HK_AccountPageObjects.MNS_HK_SignInSreen_PageObjects.<init>(MNS_HK_SignInSreen_PageObjects.java:17)

at MNS_HK_TestCases.Account_TestCases.LoginWithUserNameAndPassword(Account_TestCases.java:16)

at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)

at java.base/java.lang.reflect.Method.invoke(Method.java:578)

at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)

at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:677)

at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:221)

at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)

at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:969)

at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:194)

at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148)

at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)

at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

at org.testng.TestRunner.privateRun(TestRunner.java:829)

at org.testng.TestRunner.run(TestRunner.java:602)

at org.testng.SuiteRunner.runTest(SuiteRunner.java:437)

at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:431)

at org.testng.SuiteRunner.privateRun(SuiteRunner.java:391)

at org.testng.SuiteRunner.run(SuiteRunner.java:330)

at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)

at org.testng.TestNG.runSuitesSequentially(TestNG.java:1256)

at org.testng.TestNG.runSuitesLocally(TestNG.java:1176)

at org.testng.TestNG.runSuites(TestNG.java:1099)

at org.testng.TestNG.run(TestNG.java:1067)

at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)

at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)

at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

Caused by: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @4a16581b

at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:464)

at net.sf.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:339)

at net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:96)

at net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:94)

at net.sf.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)

at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)

at net.sf.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)

at net.sf.cglib.core.internal.LoadingCache.get(LoadingCache.java:34)

at net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:119)

at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:294)

at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:221)

at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:174)

at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:153)

at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:73)

... 37 more

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @4a16581b

at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:387)

at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:363)

at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:311)

at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:201)

at java.base/java.lang.reflect.Method.setAccessible(Method.java:195)

at net.sf.cglib.core.ReflectUtils$1.run(ReflectUtils.java:61)

at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)

at net.sf.cglib.core.ReflectUtils.<clinit>(ReflectUtils.java:52)

at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:243)

at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)

at net.sf.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:332)

... 49 more


FAILED: MNS_HK_TestCases.Account_TestCases.RegisterWithNewUserNameAndPassword

java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer

at io.appium.java_client.pagefactory.utils.ProxyFactory.getEnhancedProxy(ProxyFactory.java:53)

at io.appium.java_client.pagefactory.utils.ProxyFactory.getEnhancedProxy(ProxyFactory.java:33)

at io.appium.java_client.pagefactory.AppiumFieldDecorator.proxyForAnElement(AppiumFieldDecorator.java:208)

at io.appium.java_client.pagefactory.AppiumFieldDecorator.access$000(AppiumFieldDecorator.java:60)

at io.appium.java_client.pagefactory.AppiumFieldDecorator$1.proxyForLocator(AppiumFieldDecorator.java:99)

at org.openqa.selenium.support.pagefactory.DefaultFieldDecorator.decorate(DefaultFieldDecorator.java:63)

at io.appium.java_client.pagefactory.AppiumFieldDecorator.decorate(AppiumFieldDecorator.java:146)

at org.openqa.selenium.support.PageFactory.proxyFields(PageFactory.java:111)

at org.openqa.selenium.support.PageFactory.initElements(PageFactory.java:103)

at MNS_HK_AccountPageObjects.MNS_HK_New_Register_PageObjects.<init>(MNS_HK_New_Register_PageObjects.java:22)

at MNS_HK_TestCases.Account_TestCases.RegisterWithNewUserNameAndPassword(Account_TestCases.java:43)

at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)

at java.base/java.lang.reflect.Method.invoke(Method.java:578)

at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)

at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:677)

at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:221)

at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)

at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:969)

at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:194)

at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148)

at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)

at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

at org.testng.TestRunner.privateRun(TestRunner.java:829)

at org.testng.TestRunner.run(TestRunner.java:602)

at org.testng.SuiteRunner.runTest(SuiteRunner.java:437)

at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:431)

at org.testng.SuiteRunner.privateRun(SuiteRunner.java:391)

at org.testng.SuiteRunner.run(SuiteRunner.java:330)

at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)

at org.testng.TestNG.runSuitesSequentially(TestNG.java:1256)

at org.testng.TestNG.runSuitesLocally(TestNG.java:1176)

at org.testng.TestNG.runSuites(TestNG.java:1099)

at org.testng.TestNG.run(TestNG.java:1067)

at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)

at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)

at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

Caused by: java.lang.ExceptionInInitializerError: Exception net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @4a16581b [in thread "main"]

at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:464)

at net.sf.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:339)

at net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:96)

at net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:94)

at net.sf.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)

at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)

at net.sf.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)

at net.sf.cglib.core.internal.LoadingCache.get(LoadingCache.java:34)

at net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:119)

at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:294)

at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:221)

at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:174)

at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:153)

at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:73)

at io.appium.java_client.pagefactory.utils.ProxyFactory.getEnhancedProxy(ProxyFactory.java:53)

at io.appium.java_client.pagefactory.utils.ProxyFactory.getEnhancedProxy(ProxyFactory.java:33)

at io.appium.java_client.pagefactory.AppiumFieldDecorator.proxyForAnElement(AppiumFieldDecorator.java:208)

at io.appium.java_client.pagefactory.AppiumFieldDecorator.access$000(AppiumFieldDecorator.java:60)

at io.appium.java_client.pagefactory.AppiumFieldDecorator$1.proxyForLocator(AppiumFieldDecorator.java:99)

at org.openqa.selenium.support.pagefactory.DefaultFieldDecorator.decorate(DefaultFieldDecorator.java:63)

at io.appium.java_client.pagefactory.AppiumFieldDecorator.decorate(AppiumFieldDecorator.java:146)

at org.openqa.selenium.support.PageFactory.proxyFields(PageFactory.java:111)

at org.openqa.selenium.support.PageFactory.initElements(PageFactory.java:103)

at MNS_HK_AccountPageObjects.MNS_HK_SignInSreen_PageObjects.<init>(MNS_HK_SignInSreen_PageObjects.java:17)

at MNS_HK_TestCases.Account_TestCases.LoginWithUserNameAndPassword(Account_TestCases.java:16)

... 26 more




--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.

⇜Krishnan Mahadevan⇝

unread,
Mar 17, 2023, 6:50:14 AM3/17/23
to seleniu...@googlegroups.com
Your stacktrace indicates two things:

1. Your issue is with the appium client and not with selenium.
2. You are perhaps using JDK17 or higher and the appium client libraries are not compliant with JDK17 modules yet. Maybe you can try the recommendations in this SO post (https://stackoverflow.com/q/68117860) or downgrade to JDK11 maybe ?


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


venkatesh charla

unread,
Mar 17, 2023, 8:16:56 AM3/17/23
to seleniu...@googlegroups.com
Hi All,

I am getting this testng error.... Appium page object maven project:

could you help in solving this error

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/testng/TestNGException has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:756) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:473) at java.net.URLClassLoader.access$100(URLClassLoader.java:74) at java.net.URLClassLoader$1.run(URLClassLoader.java:369) at java.net.URLClassLoader$1.run(URLClassLoader.java:363) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:362) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class.java:3048) at java.lang.Class.getMethod0(Class.java:3018) at java.lang.Class.getMethod(Class.java:1784) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)

⇜Krishnan Mahadevan⇝

unread,
Mar 17, 2023, 8:24:48 AM3/17/23
to seleniu...@googlegroups.com
TestNG 7.5 was the last version to work with JDK8.
TestNG 7.6.x onwards, you need JDK11.

The error is saying that you should have been using JDK11, but you are using JDK8.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/

Reply all
Reply to author
Forward
0 new messages