使用Chrome在命令行上运行selenese Selenium测试

时间:2012-06-19 20:38:58

标签: macos google-chrome command-line selenium

我在Firefox中使用Selenium IDE在selenese中记录测试套件,我想使用Chrome在命令行上运行这些测试。 (我正在运行Mac OS X)。

我显然做错了,因为当我尝试这样做时,它会在Firefox中运行。

我下载了OS X的chromedriver和selenium-server-standalone jar文件,并将它们都放在/ usr / local / bin中。我认为以下命令确实需要,但它在Firefox内部而不是Chrome中运行测试。 (注意,我正在测试在http://localhost:8001运行的本地应用。)

$ java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver \
 -jar /usr/local/bin/selenium-server-standalone-2.24.1.jar \
 -htmlSuite "*chrome" http://localhost:8001 /Users/lorin/selenium/suite.html /Users/lorin//selenium/results.html

输出如下:

Jun 19, 2012 4:32:40 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
16:32:45.880 INFO - Java: Apple Inc. 20.8-b03-424
16:32:45.881 INFO - OS: Mac OS X 10.7.4 x86_64
16:32:45.887 INFO - v2.24.1, with Core v2.24.1. Built from revision 17205
16:32:45.972 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
16:32:45.973 INFO - Version Jetty/5.1.x
16:32:45.973 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
16:32:45.974 INFO - Started HttpContext[/selenium-server,/selenium-server]
16:32:45.974 INFO - Started HttpContext[/,/]
16:32:46.018 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@3b75078b
16:32:46.018 INFO - Started HttpContext[/wd,/wd]
16:32:46.024 INFO - Started SocketListener on 0.0.0.0:4444
16:32:46.025 INFO - Started org.openqa.jetty.jetty.Server@6db3f829
jar:file:/usr/local/bin/selenium-server-standalone-2.24.1.jar!/customProfileDirCUSTFFCHROME
16:32:46.103 INFO - Preparing Firefox profile...
16:32:47.013 INFO - Launching Firefox...
16:32:47.734 INFO - Checking Resource aliases
16:33:00.781 INFO - Checking Resource aliases
16:33:00.783 INFO - Received posted results
16:33:01.537 INFO - Killing Firefox...
16:33:01.608 INFO - Shutting down...

2 个答案:

答案 0 :(得分:5)

使用*googlechrome替代Chrome。那应该解决它。 * chrome用于在另一种模式下运行firefox。

答案 1 :(得分:3)

要在Firefox中运行它,您应该使用命令 * chrome

要在Chrome中运行,您应该使用命令 * googlechrome

要在Internet Explorer中运行,您应该使用 * iexplore