0

I am trying to launch Microsoft Edge browser and navigate to google.com but as soon as the browser launches the execution stops and the browser closes. I am getting the below error in the console.

org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:10102
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'xyz', ip: 'xxx.xxx.xx.xx', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_221'
Driver info: driver.version: EdgeDriver
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:141)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:96)
    at pageObjects.LaunchBrowser.browserUtility(LaunchBrowser.java:51)
    at execution.TestPrint.printJob(TestPrint.java:62)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
    at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:584)
    at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:172)
    at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
    at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:804)
    at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:145)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
    at java.util.ArrayList.forEach(Unknown Source)
    at org.testng.TestRunner.privateRun(TestRunner.java:770)
    at org.testng.TestRunner.run(TestRunner.java:591)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:402)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:396)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:355)
    at org.testng.SuiteRunner.run(SuiteRunner.java:304)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1180)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1102)
    at org.testng.TestNG.runSuites(TestNG.java:1032)
    at org.testng.TestNG.run(TestNG.java:1000)
    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.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:10102
    at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:247)
    at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:165)
    at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
    at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
    at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
    at okhttp3.RealCall.execute(RealCall.java:77)
    at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:103)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:105)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
    ... 35 more
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at okhttp3.internal.platform.Platform.connectSocket(Platform.java:129)
    at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:245)
    ... 57 more

My System configuration is as below

OS Build 18362.356
Version 1903
Edition Windows Pro

I have installed the latest Microsoft WebDriver - Release 17134.

Please find below my code:

System.setProperty("webdriver.edge.driver", "C:\\MicrosoftWebDriver.exe");

WebDriver driver = new EdgeDriver();

driver.manage().window().maximize();

driver.get("https://www.google.com/");

My Microsoft Edge version is

Microsoft Edge 44.18362.329.0

Microsoft EdgeHTML 18.18362

Could someone please help me.

Thanks

  • Have you tried putting driver into projects directory? I don't think it's working fine when in c:/ – Michal Dobrzycki Sep 18 at 7:15
  • I tried that as well it didn't work @MichalDobrzycki – User1208 Sep 18 at 23:43
  • Jainam is right you should try to downgrade the Edge Version. But I have still doubts whether this should working: Issues with edge browser Could you please afterwards share your comment which version is working for your? Because we are also facing same issues. Thanks! – Daniel Boehm Sep 19 at 6:30
  • @dbmunich you can find the solution which works for me after the update – User1208 Sep 23 at 0:07
1

It works well with me.

From the error, It seems the issue is with version compatibility. Verify that version of MicrosoftEdgeBrowser is matching with the version of MicrosoftWebDriver.

For eg. If my MicrosoftEdgeBrowser is : "Microsoft EdgeHTML 16.16299" then MicrosoftWebDriver's version should also be same (i.e. #16299), MicrosoftWebDriver's version should not be higher than Browsers version.

You can download matching version of MicrosoftWebDriver from below: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver

  • The Edge version which I have is as below Microsoft EdgeHTML 18.18362 Microsoft Edge 44.18362.329.0 In the above website which you mentioned I am unable to see the version 18 for MicrosoftWebDriver – User1208 Sep 18 at 23:12
  • I have also tried to install DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0 which they have mentioned in developer.microsoft.com/en-us/microsoft-edge/tools/webdriver Still facing the same issue. – User1208 Sep 18 at 23:20
  • Maybe Microsoft Edge version #18362 doesn't have supported Webdriver yet. For now, you can downgrade the Microsoft Edge version to (#17134 or #16299) and continue the work. – JAINAM Sep 19 at 4:42
0

I had posted this question to the Microsoft queries and I got the below solution.

https://macops.ca/installing-webdriver-as-a-feature-on-demand-in-windows-redstone-5/

This link shows how to install a webdriver for the latest version. I tried and it worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.