我正在使用硒2.47.1。我下载了客户端和服务器,然后放入我的项目中。当我启动服务器时,它会记录以下信息:
java -jar selenium-server-standalone-2.47.1.jar
22:47:10.469 INFO - Launching a standalone Selenium Server
22:47:10.522 INFO - Java: Oracle Corporation 24.79-b02
22:47:10.522 INFO - OS: Linux 3.13.0-24-generic amd64
22:47:10.547 INFO - v2.47.1, with Core v2.47.1. Built from revision 411b314
22:47:10.660 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match the current platform LINUX
22:47:10.660 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{platform=WINDOWS, browserName=MicrosoftEdge, version=}] does not match the current platform LINUX
22:47:10.661 INFO - Driver class not found: com.opera.core.systems.OperaDriver
22:47:10.661 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
22:47:10.766 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
22:47:10.766 INFO - Selenium Server is up and running
我看到了一些日志,然后我怀疑这一行:
registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match the current platform LINUX
在服务器启动并运行的情况下,我运行了我的测试项目,这是错误:
org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054 within 45000 ms
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: 'ok-ThinkPad-SL500', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-24-generic', java.version: '1.7.0_79'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.internal.SocketLock.lock(SocketLock.java:99)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:90)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:276)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:116)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:223)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:216)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:212)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
at cucumber.features.StepDefinitions.navigateToHomePage(StepDefinitions.java:26)
at ✽.Given I navigate to the home site(/home/ok/workspace/CucumberPOC/src/cucumber/features/UserRegistry.feature:6)
我从SeleniumHQ下载了selenium服务器和客户端。
答案 0 :(得分:3)
它完全没问题。请找一个示例和适当的终端语句解释,需要执行: 要求:需要在机器A和机器B上运行测试或测试套件。
例如: - 我有机器A(IP:192.168.233.155)并安装了selenium-server-xyz-version.jar。
1.启动Hub(终端声明): java -jar selenium-server-standalone-2.47.1.jar -role hub
2.要运行测试,我们需要注册节点。
java -jar selenium-server-standalone-2.47.1.jar -role node -hub
http://localhost:4444/grid/register - 浏览器 &#34; browserName =火狐,版本= 10.0.12,平台= LINUX&#34;
注意:您可以根据测试需要更改浏览器参数
java -jar selenium-server-standalone-2.47.1.jar -role node -hub
http://192.168.233.155:4444/grid/register - 浏览者 &#34; browserName =火狐,版本= 10.0.12,平台= LINUX&#34;
如果我使用的是ubuntu 14.04并使用firefox和chrome,为什么它有Internet Explorer设置?
答: 终端输出:
INFO - 驱动程序提供商org.openqa.selenium.ie.InternetExplorerDriver
注册被跳过:注册功能 功能[{platform = WINDOWS,ensureCleanSession = true, browserName = internet explorer,version =}]与当前不匹配 平台LINUX
上面的行只是针对WINDOWS进行检查的信息,现有平台是LINUX
即使在提到-browser
参数后,您仍然可以观察到相同的情况。因此,我们需要打扰的是在终端语句中提供-browser "browserName=firefox,version=10.0.12,platform=LINUX"
。
可以注册多个浏览器设置:
例如:
$ java -jar selenium-server-standalone-2.47.1.jar -role node -hub http://192.168.233.155:4444/grid/register - 浏览器 &#34; browserName =火狐,版本= 10.0.12,平台= LINUX&#34; -browser &#34; browserName =铬,平台= MAC&#34; -browser &#34; browserName = ABC,平台= XYZ&#34; -browser ........
最后[一些平台参考] http://code.google.com/p/selenium/wiki/GridPlatforms