<small id='zpZK6'></small><noframes id='zpZK6'>

<tfoot id='zpZK6'></tfoot>
      <legend id='zpZK6'><style id='zpZK6'><dir id='zpZK6'><q id='zpZK6'></q></dir></style></legend>

      • <bdo id='zpZK6'></bdo><ul id='zpZK6'></ul>
    1. <i id='zpZK6'><tr id='zpZK6'><dt id='zpZK6'><q id='zpZK6'><span id='zpZK6'><b id='zpZK6'><form id='zpZK6'><ins id='zpZK6'></ins><ul id='zpZK6'></ul><sub id='zpZK6'></sub></form><legend id='zpZK6'></legend><bdo id='zpZK6'><pre id='zpZK6'><center id='zpZK6'></center></pre></bdo></b><th id='zpZK6'></th></span></q></dt></tr></i><div id='zpZK6'><tfoot id='zpZK6'></tfoot><dl id='zpZK6'><fieldset id='zpZK6'></fieldset></dl></div>

      1. WebDriverException: java.net.ConnectException: Failed to con

        时间:2023-06-27

        <i id='sVvHK'><tr id='sVvHK'><dt id='sVvHK'><q id='sVvHK'><span id='sVvHK'><b id='sVvHK'><form id='sVvHK'><ins id='sVvHK'></ins><ul id='sVvHK'></ul><sub id='sVvHK'></sub></form><legend id='sVvHK'></legend><bdo id='sVvHK'><pre id='sVvHK'><center id='sVvHK'></center></pre></bdo></b><th id='sVvHK'></th></span></q></dt></tr></i><div id='sVvHK'><tfoot id='sVvHK'></tfoot><dl id='sVvHK'><fieldset id='sVvHK'></fieldset></dl></div>
        <tfoot id='sVvHK'></tfoot><legend id='sVvHK'><style id='sVvHK'><dir id='sVvHK'><q id='sVvHK'></q></dir></style></legend>

        1. <small id='sVvHK'></small><noframes id='sVvHK'>

          • <bdo id='sVvHK'></bdo><ul id='sVvHK'></ul>
              <tbody id='sVvHK'></tbody>

                1. 本文介绍了WebDriverException: java.net.ConnectException: Failed to connect to localhost error with Selenium 3 and chromedriver on MacOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  您好,我有这个奇怪的问题.我无法在我的 Mac 上使用 chromedriver 运行测试.我已经在这里搜索了所有可能的角落,但似乎没有任何帮助.我的浏览器已启动,但在调用 driver.get(url) 之前它就冻结了.

                  Hi I have this weird issue. I am not able to run tests with chromedriver on my Mac. I have searched every possible corner here and none seems to help. My browser is launched, but it freezes just before the driver.get(url) is called.

                  我的环境:MacOS High Sierra,截至 2018 年 3 月 12 日最新的 chromedriver,最新的 selenium 3.10,最新的 TestNG 6.14

                  My environment: MacOS High Sierra, Latest chromedriver as of 12March 2018, Latest selenium 3.10, Latest TestNG 6.14

                  我的代码:

                  public class Temp {
                  
                  @Test()
                  public void test1() {
                      System.setProperty("webdriver.chrome.driver", "src/test/resources/chromedriver");
                      ChromeOptions options = new ChromeOptions();
                      options.addArguments("--test-type");
                      options.addArguments("ignore-certificate-errors");
                      WebDriver driver = new ChromeDriver(options);
                      driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
                      driver.manage().window().maximize();
                  
                      driver.get("https://www.google.co.in/");
                      driver.quit();
                  }
                  }
                  

                  我得到的例外是:

                  [RemoteTestNG] 检测到 TestNG 版本 6.14.2在端口 34979 上启动 ChromeDriver (v2.9.248307)[警告] kq_init:检测到损坏的 kqueue;未使用.:未定义错误:02018 年 3 月 12 日上午 7:06:13 org.openqa.selenium.remote.ProtocolHandshake createSession信息:检测到的方言:OSS失败:测试1org.openqa.selenium.WebDriverException: java.net.ConnectException: 无法连接到 localhost/0:0:0:0:0:0:0:1:34979构建信息:版本:'3.10.0',修订:'176b4a9',时间:'2018-03-02T19:03:16.397Z'系统信息:主机:'sandeep-MacBook-Pro.local',ip:'192.168.0.100',os.name:'Mac OS X',os.arch:'x86_64',os.version:'10.13.3', java.version: '1.8.0_101'驱动程序信息:driver.version:RemoteWebDriver在 org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)在 org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)在 org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:658)在 org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.maximize(RemoteWebDriver.java:892)在 com.pareek.framework.tests.Temp.test1(Temp.java:22)在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)在 java.lang.reflect.Method.invoke(Method.java:498)在 org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)在 org.testng.internal.Invoker.invokeMethod(Invoker.java:580)在 org.testng.internal.Invoker.invokeTestMethod(Invoker.java:716)在 org.testng.internal.Invoker.invokeTestMethods(Invoker.java:988)在 org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)在 org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)在 org.testng.TestRunner.privateRun(TestRunner.java:648)在 org.testng.TestRunner.run(TestRunner.java:505)在 org.testng.SuiteRunner.runTest(SuiteRunner.java:455)在 org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)在 org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)在 org.testng.SuiteRunner.run(SuiteRunner.java:364)在 org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)在 org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)在 org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)在 org.testng.TestNG.runSuitesLocally(TestNG.java:1137)在 org.testng.TestNG.runSuites(TestNG.java:1049)在 org.testng.TestNG.run(TestNG.java:1017)在 org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)在 org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)在 org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)原因:java.net.ConnectException:无法连接到 localhost/0:0:0:0:0:0:0:1:34979在 okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:240)在 okhttp3.internal.connection.RealConnection.connect(RealConnection.java:158)在 okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:256)在 okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:134)在 okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:113)在 okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)在 okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)在 okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)在 okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)在 okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)在 okhttp3.RealCall.execute(RealCall.java:77)在 org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:101)在 org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:157)在 org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)... 29 更多引起:java.net.ConnectException:连接被拒绝在 java.net.PlainSocketImpl.socketConnect(本机方法)在 java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)在 java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)在 java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)在 java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)在 java.net.Socket.connect(Socket.java:589)在 okhttp3.internal.platform.Platform.connectSocket(Platform.java:125)在 okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:238)... 49 更多

                  [RemoteTestNG] detected TestNG version 6.14.2 Starting ChromeDriver (v2.9.248307) on port 34979 [warn] kq_init: detected broken kqueue; not using.: Undefined error: 0 Mar 12, 2018 7:06:13 AM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: OSS FAILED: test1 org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:34979 Build info: version: '3.10.0', revision: '176b4a9', time: '2018-03-02T19:03:16.397Z' System info: host: 'sandeep-MacBook-Pro.local', ip: '192.168.0.100', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.3', java.version: '1.8.0_101' Driver info: driver.version: RemoteWebDriver at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:658) at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.maximize(RemoteWebDriver.java:892) at com.pareek.framework.tests.Temp.test1(Temp.java:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124) at org.testng.internal.Invoker.invokeMethod(Invoker.java:580) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:716) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:988) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.privateRun(TestRunner.java:648) at org.testng.TestRunner.run(TestRunner.java:505) at org.testng.SuiteRunner.runTest(SuiteRunner.java:455) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415) at org.testng.SuiteRunner.run(SuiteRunner.java:364) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208) at org.testng.TestNG.runSuitesLocally(TestNG.java:1137) at org.testng.TestNG.runSuites(TestNG.java:1049) at org.testng.TestNG.run(TestNG.java:1017) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114) 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:34979 at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:240) at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:158) at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:256) at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:134) at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:113) 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:125) 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:101) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:157) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) ... 29 more Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at okhttp3.internal.platform.Platform.connectSocket(Platform.java:125) at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:238) ... 49 more

                  ================================================

                  ===============================================

                  默认测试

                  ================================================默认套件

                  =============================================== Default suite

                  如果我删除 driver.manage().window().maximize(); 函数的注释,异常日志如下:

                  If I remove comment out driver.manage().window().maximize(); function, the exception log is as below:

                  [RemoteTestNG] 检测到 TestNG 版本 6.14.2在端口 22528 上启动 ChromeDriver (v2.9.248307)[警告] kq_init:检测到损坏的 kqueue;未使用.:未定义错误:02018 年 3 月 12 日上午 7:29:29 org.openqa.selenium.remote.ProtocolHandshake createSession信息:检测到的方言:OSS失败:测试1org.openqa.selenium.WebDriverException:未知错误:Runtime.executionContextCreated 具有无效的上下文":{auxData":{frameId":8045B2382F1BD52FB2B8744951B53B43",isDefault":true},id":1,name":,起源":"://"}(会话信息:chrome=65.0.3325.146)(驱动程序信息:chromedriver=2.9.248307,platform=Mac OS X 10.13.3 x86_64)(警告:服务器未提供任何堆栈跟踪信息)命令持续时间或超时:0 毫秒构建信息:版本:'3.10.0',修订:'176b4a9',时间:'2018-03-02T19:03:16.397Z'系统信息:主机:'sandeep-MacBook-Pro.local',ip:'192.168.0.100',os.name:'Mac OS X',os.arch:'x86_64',os.version:'10.13.3', java.version: '1.8.0_101'驱动程序信息:org.openqa.selenium.chrome.ChromeDriver功能 {acceptSslCerts: true, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {userDataDir:/var/folders/3t/p4sy21xx2cb...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, javascriptEnabled:true,locationContextEnabled:true,nativeEvents:true,平台:MAC,platformName:MAC,可旋转:false,takesHeapSnapshot:true,takeScreenshot:true,版本:65.0.3325.146,webStorageEnabled:true}会话 ID:2301d210d1a4f56bab558a8111d856c4在 sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)在 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)在 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)在 java.lang.reflect.Constructor.newInstance(Constructor.java:423)在 org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)在 org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)在 org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)在 org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)在 org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)在 org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:160)在 org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)在 org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)在 org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:325)在 com.pareek.framework.tests.Temp.test1(Temp.java:24)在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)在 java.lang.reflect.Method.invoke(Method.java:498)在 org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)在 org.testng.internal.Invoker.invokeMethod(Invoker.java:580)在 org.testng.internal.Invoker.invokeTestMethod(Invoker.java:716)在 org.testng.internal.Invoker.invokeTestMethods(Invoker.java:988)在 org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)在 org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)在 org.testng.TestRunner.privateRun(TestRunner.java:648)在 org.testng.TestRunner.run(TestRunner.java:505)在 org.testng.SuiteRunner.runTest(SuiteRunner.java:455)在 org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)在 org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)在 org.testng.SuiteRunner.run(SuiteRunner.java:364)在 org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)在 org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)在 org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)在 org.testng.TestNG.runSuitesLocally(TestNG.java:1137)在 org.testng.TestNG.runSuites(TestNG.java:1049)在 org.testng.TestNG.run(TestNG.java:1017)在 org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)在 org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)在 org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

                  [RemoteTestNG] detected TestNG version 6.14.2 Starting ChromeDriver (v2.9.248307) on port 22528 [warn] kq_init: detected broken kqueue; not using.: Undefined error: 0 Mar 12, 2018 7:29:29 AM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: OSS FAILED: test1 org.openqa.selenium.WebDriverException: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"8045B2382F1BD52FB2B8744951B53B43","isDefault":true},"id":1,"name":"","origin":"://"} (Session info: chrome=65.0.3325.146) (Driver info: chromedriver=2.9.248307,platform=Mac OS X 10.13.3 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 0 milliseconds Build info: version: '3.10.0', revision: '176b4a9', time: '2018-03-02T19:03:16.397Z' System info: host: 'sandeep-MacBook-Pro.local', ip: '192.168.0.100', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.3', java.version: '1.8.0_101' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities {acceptSslCerts: true, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {userDataDir: /var/folders/3t/p4sy21xx2cb...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, javascriptEnabled: true, locationContextEnabled: true, nativeEvents: true, platform: MAC, platformName: MAC, rotatable: false, takesHeapSnapshot: true, takesScreenshot: true, version: 65.0.3325.146, webStorageEnabled: true} Session ID: 2301d210d1a4f56bab558a8111d856c4 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166) at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40) at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80) at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:160) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601) at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:325) at com.pareek.framework.tests.Temp.test1(Temp.java:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124) at org.testng.internal.Invoker.invokeMethod(Invoker.java:580) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:716) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:988) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.privateRun(TestRunner.java:648) at org.testng.TestRunner.run(TestRunner.java:505) at org.testng.SuiteRunner.runTest(SuiteRunner.java:455) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415) at org.testng.SuiteRunner.run(SuiteRunner.java:364) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208) at org.testng.TestNG.runSuitesLocally(TestNG.java:1137) at org.testng.TestNG.runSuites(TestNG.java:1049) at org.testng.TestNG.run(TestNG.java:1017) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

                  ================================================

                  ===============================================

                  默认测试

                  ================================================默认套件

                  =============================================== Default suite

                  附加信息:我试图通过使用旧版本的 chromedriver、旧版本的 TestNG、旧版本的 selenium 来进行回归,但似乎都没有工作.

                  Additional Info: I have tried to do a regression by using older version of chromedriver, older version of TestNG, older version of selenium, but none seems to be working.

                  提前致谢.

                  推荐答案

                  错误说明了一切:

                  [RemoteTestNG] detected TestNG version 6.14.2 Starting ChromeDriver (v2.9.248307) on port 34979 
                  [warn] kq_init: detected broken kqueue; not using.: Undefined error: 0 Mar 12, 2018 7:06:13 AM 
                  org.openqa.selenium.remote.ProtocolHandshake createSession 
                  INFO: Detected dialect: OSS FAILED: test1
                  org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:34979 
                  Build info: version: '3.10.0', revision: '176b4a9', time: '2018-03-02T19:03:16.397Z' 
                  System info: host: 'sandeep-MacBook-Pro.local', ip: '192.168.0.100', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.3', java.version: '1.8.0_101'
                  

                  您的主要问题是您使用的二进制文件之间的版本兼容性,如下所示:

                  Your main issue is the version compatibility between the binaries you are using as follows :

                  • 您正在使用 chromedriver=v2.9
                  • chromedriver=2.9的发布说明明确提到以下内容:

                  支持 Chrome v31-34

                  • 我们不知道您的 Chrome 浏览器 版本.(假设 Chrome 浏览器更新到 v65.x 级别)
                  • 您的 Selenium 客户端 版本是 3.10.0.
                  • 您的 JDK 版本1.8.0_101,非常古老.
                    • Your Chrome Browser version is unknown to us. (assuming Chrome Browser is updated to v65.x level)
                    • Your Selenium Client version is 3.10.0.
                    • Your JDK version is 1.8.0_101 which is pretty ancient.
                    • 所以 JDK v8u101Selenium Client v3.10.0ChromeDriver 版本(v2.9) 和当前的 Chrome 浏览器 版本 (v65.0)

                      So there is a clear mismatch between the JDK v8u101 , Selenium Client v3.10.0 , ChromeDriver version (v2.9) and the current Chrome Browser version (v65.0)

                      • JDK 升级到最新级别 JDK 8u162.
                      • Selenium 保持在当前水平版本 3.10.0.
                      • ChromeDriver 升级到稳定的 ChromeDriver v2.36 级.
                      • Chrome 版本保持在 Chrome v65.x 级别.(根据 ChromeDriver v2.36 发行说明)
                      • 清理你的项目工作区通过你的IDE重建你的项目只需要依赖.
                      • 使用 CCleaner 工具清除之前和之后的所有操作系统杂务测试套件的执行.
                      • 如果您的基础 Chrome 版本太旧,请通过 Revo Uninstaller 并安装最新的 GA 和已发布版本的 Chrome.
                      • 执行你的 @Test.
                      • Upgrade JDK to recent levels JDK 8u162.
                      • Keep Selenium to current levels Version 3.10.0.
                      • Upgrade ChromeDriver to stable ChromeDriver v2.36 level.
                      • Keep Chrome version at Chrome v65.x levels. (as per ChromeDriver v2.36 release notes)
                      • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
                      • Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
                      • If your base Chrome version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Chrome.
                      • Execute your @Test.

                      这篇关于WebDriverException: java.net.ConnectException: Failed to connect to localhost error with Selenium 3 and chromedriver on MacOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Selenium Select - 通过部分文本选择下拉选项 下一篇:Selenium Chromedriver 服务器超时,尽管可用

                  相关文章

                2. <legend id='IN29Z'><style id='IN29Z'><dir id='IN29Z'><q id='IN29Z'></q></dir></style></legend>
                  <tfoot id='IN29Z'></tfoot>

                  1. <small id='IN29Z'></small><noframes id='IN29Z'>

                      • <bdo id='IN29Z'></bdo><ul id='IN29Z'></ul>
                      <i id='IN29Z'><tr id='IN29Z'><dt id='IN29Z'><q id='IN29Z'><span id='IN29Z'><b id='IN29Z'><form id='IN29Z'><ins id='IN29Z'></ins><ul id='IN29Z'></ul><sub id='IN29Z'></sub></form><legend id='IN29Z'></legend><bdo id='IN29Z'><pre id='IN29Z'><center id='IN29Z'></center></pre></bdo></b><th id='IN29Z'></th></span></q></dt></tr></i><div id='IN29Z'><tfoot id='IN29Z'></tfoot><dl id='IN29Z'><fieldset id='IN29Z'></fieldset></dl></div>