Selenium HTML Runner:端口已在使用中

时间:2017-01-09 10:50:52

标签: selenium selenium-firefoxdriver geckodriver

我正在使用selenium html runner来运行selenise脚本。

java -jar selenium-html-runner-3.0.1.jar -htmlSuite *firefox "https://www.google.com/" "D://file.html" "D://r.html"

在运行任何浏览器时,我收到此错误堆栈:

Jan 09, 2017 4:14:47 PM org.openqa.selenium.server.htmlrunner.HTMLLauncher mainInt
WARNING: Test of browser failed: *firefox
java.io.IOException: java.lang.RuntimeException: java.net.BindException: Address already in use: JVM_Bind
        at org.openqa.selenium.server.htmlrunner.HTMLLauncher.determineSuiteUrl(HTMLLauncher.java:180)
        at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:108)
        at org.openqa.selenium.server.htmlrunner.HTMLLauncher.mainInt(HTMLLauncher.java:245)
        at org.openqa.selenium.server.htmlrunner.HTMLLauncher.main(HTMLLauncher.java:273)
Caused by: java.lang.RuntimeException: java.net.BindException: Address already in use: JVM_Bind
        at org.openqa.selenium.net.PortProber.pollPort(PortProber.java:154)
        at org.openqa.selenium.net.PortProber.pollPort(PortProber.java:137)
        at org.openqa.selenium.server.htmlrunner.HTMLLauncher.determineSuiteUrl(HTMLLauncher.java:174)
        ... 3 more
Caused by: java.net.BindException: Address already in use: JVM_Bind
        at java.net.DualStackPlainSocketImpl.bind0(Native Method)
        at java.net.DualStackPlainSocketImpl.socketBind(DualStackPlainSocketImpl.java:106)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:190)
        at java.net.Socket.bind(Socket.java:644)
        at org.openqa.selenium.net.PortProber.pollPort(PortProber.java:146)
        ... 5 more

我正在使用html runner 3,firefox 50,geckodriver 0.11

1 个答案:

答案 0 :(得分:1)

看起来像一个套接字绑定异常,我认为是默认端口,并且正在运行其他一些进程。

您可以使用以下方式检查:

netstat -a

您是否尝试更改端口号?

只需附加-port 7272(或任何其他端口号)

尝试:

java -jar selenium-html-runner-3.0.1.jar -htmlSuite *firefox "https://www.google.com/" "D://file.html" "D://r.html" -port 7272