Selenium Server 3.8.1 / Firefox 只打开一个空白页面

Selenium Server 3.8.1 / Firefox opens just a blank page

我在 Selenium Server 3.8.1 ...

上苦苦挣扎了几个小时

我无法在我的电脑上 运行 ...; Firefox 只打开一个空白页面而不是 www.toolsqa.com ...

Selenium Server 3.8.1 / Win7 64 Bit / Firefox 57.0.4 64 Bit / Geckodriver 0.19.1 64 Bit / Java JDK 1.8 Update 112

我也玩过 FirefoxOptions() 但都是徒劳的。

P.S.: My local Selenium runs perfect.

请问有什么提示吗?

非常感谢。

============================================= ===============

集线器和节点是 运行 默认值:

中心 :

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()

============================================= ===============

在中心屏幕上输出

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

好吧,更新您的步骤会变得更容易,但详细的错误跟踪日志会更有帮助。主要问题出在 Selenium Grid Nodestartup 过程中。如果你想使用 GeckoDriver,你必须使用以下命令启动 Selenium Grid Node

java -Dwebdriver.gecko.driver=geckodriver.exe -jar selenium-server-standalone-3.8.1.jar -role node -hub http://localhost:4444/grid/register

非常感谢 Debanjan - 现在是 运行!!!

P.S.: 如果 geckodriver.exe 不在 Windows-Search-Path 中,则必须以路径为前缀;就我而言:

java -Dwebdriver.gecko.driver=e:\geckodriver.exe -jar selenium-server-standalone-3.8.1.jar -role node -hub http://localhost:4444/grid/register

问候 乔