2

我正在使用 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

4

1 回答 1

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
于 2017-01-12T21:21:09.273 回答