2017-01-09 29 views
2

我使用selenium html runner來運行selenise腳本。Selenium HTML Runner:port已經在使用

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亞軍3,火狐50,geckodriver 0.11

回答

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