selenium 启动火狐浏览器报Failed to connect to localhost/0:0:0:0:0:0:0:1:31153

来源:6-1 常见浏览器的启动

勿莣洎莪

2019-08-09 10:00

Usage:

    C:\Users\14199\AppData\Local\Mozilla Firefox\geckodriver.exe [OPTIONS]

C:\Users\14199\AppData\Local\Mozilla Firefox\geckodriver.exe: Unknown option --port=31153


org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:31153

Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'

System info: host: 'DESKTOP-UENJT9H', ip: '192.168.1.200', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_73'

Driver info: driver.version: FirefoxDriver


at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)

at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)

at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)

at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)

at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:103)

at test2.name3(test2.java:107)

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:497)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

at org.junit.runners.ParentRunner.run(ParentRunner.java:363)

at org.junit.runner.JUnitCore.run(JUnitCore.java:137)

at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)

at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)

at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)

at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Caused by: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:31153

at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:242)

at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:160)

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:105)

at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:101)

at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)

at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)

at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)

... 28 more

Caused by: java.net.ConnectException: Connection refused: connect

at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)

at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)

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.PlainSocketImpl.connect(PlainSocketImpl.java:172)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at okhttp3.internal.platform.Platform.connectSocket(Platform.java:129)

at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:240)


写回答 关注

1回答

  • 慕神5158277
    2019-11-24 22:08:15

    应该是驱动geckodriver.exe版本问题,换个与selenium匹配的版本;

自动化测试之selenium工具使用

web自动化测试selenium从0基础开始。

51929 学习 · 192 问题

查看课程

相似问题