使用 selenium-server-standalone-2.18.0.jar。在同一主机上运行集线器和节点。在单独的主机上运行客户端代码
在集线器控制台中,我可以看到其中一个节点连接了 5 个 firefox 图标。当我运行我的客户端代码时,我看到其中一个 firefox 图标被带走,就好像集线器已向连接的节点发出请求一样。我在集线器日志中看不到任何错误。我正在使用 ruby + watir-webdriver 启动浏览器,如下所示:
capabilities = WebDriver::Remote::Capabilities.firefox
b=Watir::Browser.new(:remote, :url => "http://[remote-host]:4444/wd/hub", :desired_capabilities => capabilities)
我收到的错误是:
from (irb):52>> b=Watir::Browser.new(:remote, :url => "http://[remote-host]:4444/wd/hub", :desired_capabilities => capabilities)
Selenium::WebDriver::Error::UnknownError: Error forwarding the new session new session request for webdriver should contain a location header with the session. (org.openqa.grid.common.exception.GridException)
from [remote server] org.openqa.grid.web.servlet.handler.RequestHandler(RequestHandler.java):151:in `process'
from [remote server] org.openqa.grid.web.servlet.DriverServlet(DriverServlet.java):81:in `process' from [remote server] org.openqa.grid.web.servlet.DriverServlet(DriverServlet.java):67:in `doPost'
from [remote server] javax.servlet.http.HttpServlet(HttpServlet.java):727:in `service'
from [remote server] javax.servlet.http.HttpServlet(HttpServlet.java):820:in `service'
from [remote server] org.openqa.jetty.jetty.servlet.ServletHolder(ServletHolder.java):428:in `handle'from [remote server] org.openqa.jetty.jetty.servlet.WebApplicationHandler(WebApplicationHandler.java):473:in `dispatch' from [remote server] org.openqa.jetty.jetty.servlet.ServletHandler(ServletHandler.java):568:in \`handle'
from [remote server] org.openqa.jetty.http.HttpContext(HttpContext.java):1530:in `handle'
from [remote server] org.openqa.jetty.jetty.servlet.WebApplicationContext(WebApplicationContext.java):633:in `handle' from [remote server] org.openqa.jetty.http.HttpContext(HttpContext.java):1482:in `handle'
...