2014-02-22 69 views
2

我在Firefox中配置了Selenium 2.0 IDE,並使用此IDE執行我的項目。如何使用其他瀏覽器運行硒?

  1. 使用IDE執行項目。
  2. 而我播放執行的屏幕。
  3. 保存HTML和Java格式的測試用例。 (對於Java:我使用Jnit/Webdriver)
  4. 然後我打開java文件使用eclipse更改爲Chrome驅動程序
  5. 之後,我將此代碼追加到該System.setProperty();
  6. 然後我使用執行Chromewebdriver命令提示的java -Dwebdriver.chrome.driver = /路徑/到/ chromedriver罐子硒 - 服務器 - 獨立-2.7.0.jar
  7. 然後我得到了誤差作爲
C:\Program Files\Java\jdk1.6.0\bin>java -Dwebdriver.chrome.driver=c:/Users/FSP/D 
ownloads/chromedriver.exe -jar selenium-server-standalone-2.39.0.jar 
Unable to access jarfile selenium-server-standalone-2.39.0.jar 
C:\Program Files\Java\jdk1.6.0\bin>java -Dwebdriver.chrome.driver=c:/Users/FSP/D 
ownloads/chromedriver.exe -jar c:/Users/FSP/Downloads/selenium-server-standalone 
-2.39.0.jar 
Feb 22, 2014 6:48:37 PM org.openqa.grid.selenium.GridLauncher main 
INFO: Launching a standalone server 
18:48:39.395 INFO - Java: Sun Microsystems Inc. 1.6.0-b105 
18:48:39.405 INFO - OS: Windows Vista 6.1 x86 
18:48:39.618 INFO - v2.39.0, with Core v2.39.0. Built from revision ff23eac 
18:48:40.440 INFO - Default driver org.openqa.selenium.iphone.IPhoneDriver regis 
tration is skipped: registration capabilities Capabilities [{platform=MAC, brows 
erName=iPhone, version=}] does not match with current platform: VISTA 
18:48:40.500 INFO - Default driver org.openqa.selenium.iphone.IPhoneDriver regis 
tration is skipped: registration capabilities Capabilities [{platform=MAC, brows 
erName=iPad, version=}] does not match with current platform: VISTA 
18:48:41.089 INFO - RemoteWebDriver instances should connect to: 
18:48:41.091 INFO - Version Jetty/5.1.x 
18:48:41.122 INFO - Started HttpContext[/selenium-server/driver,/selenium-server 
/driver] 
18:48:41.124 INFO - Started HttpContext[/selenium-server,/selenium-server] 
18:48:41.125 INFO - Started HttpContext[/,/] 
18:48:41.772 INFO - Started [email protected] 
f 
18:48:41.772 INFO - Started HttpContext[/wd,/wd] 
18:48:41.799 WARN - Failed to start: [email protected]:4444 
Exception in thread "main" org.openqa.jetty.util.MultiException[java.net.SocketE 
xception: Unrecognized Windows Sockets error: 0: JVM_Bind] 
     at org.openqa.jetty.http.HttpServer.doStart(HttpServer.java:696) 
     at org.openqa.jetty.util.Container.start(Container.java:72) 
     at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:4 
88) 
     at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:30 
0) 
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:24 
5) 
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:96) 
java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind 
at java.net.PlainSocketImpl.socketBind(Native Method) 
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359) 
at java.net.ServerSocket.bind(ServerSocket.java:319) 
at java.net.ServerSocket.<init>(ServerSocket.java:185) 
at org.openqa.jetty.util.ThreadedServe`enter code here`r.newServerSocket(ThreadedServer.j 
ava:392) 
at org.openqa.jetty.util.ThreadedServer.open(ThreadedServer.java:478) 
at org.openqa.jetty.util.ThreadedServer.start(ThreadedServer.java:504) 
at org.openqa.jetty.http.SocketListener.start(SocketListener.java:202) 
at org.openqa.jetty.http.HttpServer.doStart(HttpServer.java:726) 
at org.openqa.jetty.util.Container.start(Container.java:72) 
at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:4 
88) 
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:30 
0) 
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:24 
5) 
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:96) 
C:\Program Files\Java\jdk1.6.0\bin> 

如何解決這個問題?所以請嘗試使用webdriver概念通過其他瀏覽器配置和運行腳本。

+0

錯誤消息的第一行非常清晰:selenium-server-standalone-2.39.0。 jar'找不到。在你的腳本中,我注意到你在前面加上「/ path/to /」 - 在說明中,這意味着你需要自己提供路徑。無論您將jar文件放在哪裏,都必須通過其路徑進行標識。 –

回答

0

這可能是類路徑問題....

下載最新版本的硒,說從seleniumHQ.org網站2.39.0。

將它放在C:\驅動器中。轉到環境變量並將java -jar selenium-server-standalone-2.39.0.jar添加到類路徑

相關問題