Specifying Windows Versions (or Specific Machines) in Selenium Grid

跟風遠走 提交于 2019-12-01 01:41:40

You can possibly specify the IP in the node configuration json file on your node machine:

{
    "capabilities":
    [
        {
            "platform": "WINDOWS",
            "browserName": "firefox",
            "maxInstances": 1,
            "seleniumProtocol": "WebDriver",
            "nodeip": "192.168.0.123"
        }
    ],
    "configuration":
        {
            "proxy":"org.openqa.grid.selenium.proxy.WebDriverRemoteProxy",
            "maxSession":1,
            "url":"http://192.168.0.99:4444/wd/hub"
        }
}

And then request the specific node:

DesiredCapabilities caps = DesiredCapabilities.firefox();   
caps.setCapability("platform", Platform.WINDOWS);
caps.setCapability("nodeip", "192.168.0.123"); 
RemoteWebDriver driver = new RemoteWebDriver(new URL(hubUrl), caps); 

Alternatively, you can possibly use the applicationName capability or the Browser Version capability to specify your IP/custom value as selenium grid does a simple string match on these. See the below google group discussions on using existing capabilities for identifying a specific node:

Using the applicationName capability

Using the Browser Version capability

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!