【发布时间】:2018-01-13 08:14:51
【问题描述】:
我在 Selenium Server 3.8.1 上苦苦挣扎了好几个小时...
我无法让它在我的电脑上运行...; Firefox 只会打开一个空白页面,但不会打开 www.toolsqa.com ...
Selenium Server 3.8.1 / Win7 64 位 / Firefox 57.0.4 64 位 / Geckodriver 0.19.1 64 位 / Java JDK 1.8 更新 112
我也玩过 FirefoxOptions(),但都是徒劳的。
P.S.:我的本地 Selenium 运行完美。
你有什么建议吗?
非常感谢。
================================================ ==============
Hub 和 Node 使用默认值运行:
集线器:
java -jar selenium-server-standalone-3.8.1.jar -role hub
节点:
java -jar selenium-server-standalone-3.8.1.jar -role node -hub http://localhost:4444/grid/register
在中心屏幕上:
07:17:59.688 INFO - Selenium Grid hub is up and running
07:18:13.884 INFO - Registered a node http://10.0.0.1:5555
在节点屏幕上:
07:18:13.619 INFO - Registering the node to the hub: http://localhost:4444/grid/register
07:18:13.884 INFO - The node is registered to the hub and ready to use
================================================ ==============
代码:
System.setProperty("webdriver.gecko.driver", "e:\\geckodriver.exe");
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
capabilities.setBrowserName("firefox");
URL url = new URL("http://localhost:4444/wd/hub");
RemoteWebDriver driver = new RemoteWebDriver(url, capabilities);
driver.get("http://www.toolsqa.com");
================================================ ==============
Eclipse 控制台上的输出就是这样 - 没有别的:
Jan 13, 2018 9:33:22 AM org.openqa.selenium.remote.DesiredCapabilities firefox
INFORMATION: Using new FirefoxOptions() is preferred to DesiredCapabilities.firefox()
================================================ ==============
输出在 Hub 屏幕上:
D:\Java\Selenium-Test-Software>java -jar selenium-server-standalone-3.8.1.jar -role hub
09:33:00.087 INFO - Selenium build info: version: '3.8.1', revision: '6e95a6684b'
09:33:00.087 INFO - Launching Selenium Grid hub
2018-01-13 09:33:00.991:INFO::main: Logging initialized @1229ms to org.seleniumhq.jetty9.util.log.StdErrLog
09:33:01.007 INFO - Will listen on 4444
2018-01-13 09:33:01.069:INFO:osjs.Server:main: jetty-9.4.7.v20170914
2018-01-13 09:33:01.085:INFO:osjs.session:main: DefaultSessionIdManager workerName=node0
2018-01-13 09:33:01.085:INFO:osjs.session:main: No SessionScavenger set, using defaults
2018-01-13 09:33:01.101:INFO:osjs.session:main: Scavenging every 600000ms
2018-01-13 09:33:01.101:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@62e136d3{/,null,AVAILABLE}
2018-01-13 09:33:01.116:INFO:osjs.AbstractConnector:main: Started ServerConnector@5d47c63f{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2018-01-13 09:33:01.116:INFO:osjs.Server:main: Started @1365ms
09:33:01.116 INFO - Nodes should register to http://10.0.0.1:4444/grid/register/
09:33:01.116 INFO - Selenium Grid hub is up and running
09:33:10.273 INFO - Registered a node http://10.0.0.1:5555
09:33:24.001 INFO - Got a request to create a new session: Capabilities {acceptInsecureCerts: true, browserName: firefox, marionette: true, version: }
09:33:24.017 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, marionette=true, se:CONFIG_UUID=8c1ad163-51a6-4294-967d-66985bc53995, browserName=firefox, maxInstances=5, platform=VISTA}
============================================================
节点屏幕上的输出:
09:33:10.071 INFO - Using new EdgeOptions() is preferred to DesiredCapabilities.edge()
09:33:10.071 INFO - Using new FirefoxOptions() is preferred to DesiredCapabilities.firefox()
09:33:10.071 INFO - Using new OperaOptions() is preferred to DesiredCapabilities.operaBlink()
09:33:10.071 INFO - Using new SafariOptions() is preferred to DesiredCapabilities.safari()
09:33:10.086 INFO - Using the passthrough mode handler
2018-01-13 09:33:10.102:INFO:osjs.Server:main: jetty-9.4.7.v20170914
2018-01-13 09:33:10.133:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@ae13544{/,null,STARTING} has uncovered http methods for path: /
2018-01-13 09:33:10.133:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@ae13544{/,null,AVAILABLE}
2018-01-13 09:33:10.149:INFO:osjs.AbstractConnector:main: Started ServerConnector@3294b8a0{HTTP/1.1,[http/1.1]}{0.0.0.0:5555}
2018-01-13 09:33:10.149:INFO:osjs.Server:main: Started @1445ms
09:33:10.149 INFO - Selenium Grid node is up and ready to register to the hub
09:33:10.164 INFO - Starting auto registration thread. Will try to register every 5000 ms.
09:33:10.164 INFO - Registering the node to the hub: http://localhost:4444/grid/register
09:33:10.273 INFO - The node is registered to the hub and ready to use
2018-01-13 09:33:24.033:INFO:osjshC.ROOT:qtp2013559698-14: org.openqa.selenium.remote.server.WebDriverServlet-639c2c1d: Initialising WebDriverServlet
09:33:24.048 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession@3288da3c
09:33:24.048 INFO - /session: Executing POST on /session (handler: BeginSession)
09:33:24.142 INFO - Capabilities are: Capabilities {acceptInsecureCerts: true, browserName: firefox, marionette: true, version: }
09:33:24.142 INFO - Capabilities {acceptInsecureCerts: true, browserName: firefox, marionette: true, version: } matched class org.openqa.selenium.remote.server.
ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService)
1515832404376 geckodriver INFO Listening on 127.0.0.1:44674
1515832404688 mozprofile::profile INFO Using profile path C:\Users\Stxxxxx\AppData\Local\Temp\rust_mozprofile.EIKHplrPpffl
1515832404703 geckodriver::marionette INFO Starting browser C:\Program Files (x86)\Mozilla Firefox\firefox.exe
1515832404719 geckodriver::marionette INFO Connecting to Marionette on localhost:58255
【问题讨论】:
-
你能添加你用来启动
HUB和NODE的命令吗?在07:17:59.688 INFO - Selenium Grid hub is up and running和07:18:13.884 INFO - Registered a node http://10.0.0.1:5555之间发生了很多事情。你能用堆栈跟踪更新问题吗? -
我现在已经添加了输出消息。谢谢。
标签: selenium firefox selenium-webdriver selenium-grid