尝试启动selenium时出现以下错误:
C:\Temp\selenium-server-1.0.3>java -jar selenium-server.jar 22:02:07.615 INFO - Java: Sun Microsystems Inc. 16.0-b13 22:02:07.617 INFO - OS: Windows 7 6.1 x86 22:02:07.625 INFO - v2.0 [a2],with Core v2.0 [a2] 22:02:07.811 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub 22:02:07.813 INFO - Version Jetty/5.1.x 22:02:07.815 INFO - Started HttpContext[/selenium-server/driver,/selenium-server /driver] 22:02:07.817 INFO - Started HttpContext[/selenium-server,/selenium-server] 22:02:07.818 INFO - Started HttpContext[/,/] 22:02:07.866 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@2bbd86 22:02:07.867 INFO - Started HttpContext[/wd,/wd] 22:02:07.870 WARN - Failed to start: SocketListener0@0.0.0.0:4444 Exception in thread "main" org.openqa.jetty.util.MultiException[java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind] at org.openqa.jetty.http.HttpServer.doStart(HttpServer.java:686) at org.openqa.jetty.util.Container.start(Container.java:72) at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:396) at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:234) at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:198) java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(Unknown Source) at java.net.ServerSocket.bind(Unknown Source) at java.net.ServerSocket.<init>(Unknown Source) at org.openqa.jetty.util.ThreadedServer.newServerSocket(ThreadedServer.java:391) at org.openqa.jetty.util.ThreadedServer.open(ThreadedServer.java:477) at org.openqa.jetty.util.ThreadedServer.start(ThreadedServer.java:503) at org.openqa.jetty.http.SocketListener.start(SocketListener.java:204) at org.openqa.jetty.http.HttpServer.doStart(HttpServer.java:716) at org.openqa.jetty.util.Container.start(Container.java:72) at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:396) at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:234) at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:198)
安装Java:
C:\Temp\selenium-server-1.0.3>java -version java version "1.6.0_18" Java(TM) SE Runtime Environment (build 1.6.0_18-b07) Java HotSpot(TM) Client VM (build 16.0-b13,mixed mode,sharing)
在命令提示符上尝试此(netstat -a)以查看此端口(4444 – Selenium默认端口)是否正被某些其他服务或侦听使用.
要么
使用不同的端口启动selenium.
例:
java -jar selenium-server.jar -port 5561
谢谢,
阿糖胞苷