我设置了一个 selenium 网格并添加了一个 chrome、一个 ie 和两个 firefox(esr 和 current)。在我看来,设置和调用代码是正确的,但网格/节点忽略了我的 Firefox 浏览器版本。
我在一个节点中设置了两个浏览器:
-browser browserName=firefox,version=34,maxInstances=5,firefox_binary=C:\Program Files (x86)\Mozilla Firefox\firefox.exe,firefox_profile=standard
-browser browserName=firefox,version=31,maxInstances=5,firefox_binary=C:\Program Files (x86)\Mozilla Firefox ESR\firefox.exe,firefox_profile=esr
它们在网格中显示为版本 31 和 34。
节点日志显示它们已添加:
10:09:21.107 INFO [1] org.openqa.grid.common.RegistrationRequest - Adding browserName=firefox,version=34,maxInstances=5,firefox_binary=C:\Program Files (x86)\Mozilla Firefox\firefox.exe,firefox_profile=standard
10:09:21.109 INFO [1] org.openqa.grid.common.RegistrationRequest - Adding browserName=firefox,version=31,maxInstances=5,firefox_binary=C:\Program Files (x86)\Mozilla Firefox ESR\firefox.exe,firefox_profile=esr
当使用版本 31 和 34 调用网格时,两个请求都引用到版本 34 实例。
从网格日志:
10:10:38.865 INFO [13] org.openqa.grid.web.servlet.handler.RequestHandler - Got a request to create a new session: Capabilities [{browserName=firefox, version=31, platform=VISTA}]
10:10:38.866 INFO [10] org.openqa.grid.internal.ProxySet - Available nodes: [host :http://sel-node:5555]
10:10:38.866 INFO [10] org.openqa.grid.internal.BaseRemoteProxy - Trying to create a new session on node host :http://sel-node:5555
10:10:38.866 INFO [10] org.openqa.grid.internal.TestSlot - Trying to create a new session on test slot {firefox_binary=C:\Program Files (x86)\Mozilla Firefox\firefox.exe, seleniumProtocol=WebDriver, browserName=firefox, maxInstances=5, version=34, platform=VISTA, firefox_profile=standard}
10:10:39.388 INFO [35] org.openqa.grid.web.servlet.handler.RequestHandler - Got a request to create a new session: Capabilities [{browserName=firefox, version=34, platform=VISTA}]
10:10:39.388 INFO [10] org.openqa.grid.internal.ProxySet - Available nodes: [host :http://sel-node:5555]
10:10:39.388 INFO [10] org.openqa.grid.internal.BaseRemoteProxy - Trying to create a new session on node host :http://sel-node:5555
10:10:39.388 INFO [10] org.openqa.grid.internal.TestSlot - Trying to create a new session on test slot {firefox_binary=C:\Program Files (x86)\Mozilla Firefox\firefox.exe, seleniumProtocol=WebDriver, browserName=firefox, maxInstances=5, version=34, platform=VISTA, firefox_profile=standard}
10:26:37.194 INFO [35] org.openqa.grid.web.servlet.handler.RequestHandler - Got a request to create a new session: Capabilities [{browserName=firefox, version=31, platform=VISTA}]
调用代码是:
URL grid = new URL("http://sel-grid:4444/wd/hub");
DesiredCapabilities caps = DesiredCapabilities.firefox();
caps.setPlatform(Platform.VISTA);
caps.setVersion("31"); // or 34
WebDriver driver = new RemoteWebDriver(grid,caps);
driver.get("http://www.google.com");
我省略了 chrome 和 ie 配置。如果我打电话给他们,他们就会很好地触发,但我那里没有版本。