我尝试远程执行我的测试用例。我在服务器上使用这些命令来运行Xvfb:
Xvfb :3 -screen 5 1024x768x8 &
export DISPLAY=:3.5
之后我尝试启动Selenium
独立服务器,但此命令失败:
java -jar selenium-server-standalone-3.5.2.jar -Dwebdriver.chrome.bin=/path/to/google-chrome -Dwebdriver.chrome.driver=/path/to/chromedriver
所以我用过这个:
java -jar selenium-server-standalone-3.5.2.jar
我得到以下登录终端:
09:27:33.239 INFO - Selenium build info: version: '3.5.2', revision: '10229a9020'
09:27:33.244 INFO - Launching a standalone Selenium Server
2017-09-13 09:27:34.207:INFO::main: Logging initialized @11716ms to org.seleniumhq.jetty9.util.log.StdErrLog
09:27:36.112 INFO - Driver class not found: com.opera.core.systems.OperaDriver
09:27:37.714 INFO - Driver provider class org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX
09:27:37.714 INFO - Driver provider class org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX
09:27:37.715 INFO - Driver provider class org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform LINUX
09:27:38.432 INFO - Using the passthrough mode handler
2017-09-13 09:27:38.819:INFO:osjs.Server:main: jetty-9.4.5.v20170502
2017-09-13 09:27:38.929:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@6536e911{/,null,STARTING} has uncovered http methods for path: /
2017-09-13 09:27:39.005:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@6536e911{/,null,AVAILABLE}
2017-09-13 09:27:39.128:INFO:osjs.AbstractConnector:main: Started ServerConnector@63e2203c{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-09-13 09:27:39.136:INFO:osjs.Server:main: Started @16646ms
09:27:39.136 INFO - Selenium Server is up and running
我按如下方式初始化了Webdriver变量:
driver = new RemoteWebDriver(new URL("http://<my-server-ip>:444/wd/hub"),caps);
我执行了项目并收到以下错误消息:
org.openqa.selenium.remote.UnreachableBrowserException:无法启动新会话。可能的原因是遥控器的无效地址 服务器或浏览器启动失败。 构建信息:版本:'3.5.2',修订版:'10229a9'
如何设置,应该远程启动哪个浏览器?我怎么能开始新的会议?