Java Selenium Webdriver:将测试限制到网格中的特定平台

Java Selenium Webdriver:将测试限制到网格中的特定平台,java,selenium,selenium-webdriver,webdriver,selenium-grid,Java,Selenium,Selenium Webdriver,Webdriver,Selenium Grid,我的远程webdriver会话的设置有问题,似乎是一夜之间出现的。我的代码过去可以工作,但现在当我尝试将平台值作为功能传递时,我遇到了以下错误: session not created: No matching capabilities found 设置Webdriver对象的Java代码如下所示: private void setupRemoteDriver() throws MalformedURLException { // Set browser to Chrome C

我的远程webdriver会话的设置有问题,似乎是一夜之间出现的。我的代码过去可以工作,但现在当我尝试将平台值作为功能传递时,我遇到了以下错误:

session not created: No matching capabilities found
设置Webdriver对象的Java代码如下所示:

private void setupRemoteDriver() throws MalformedURLException {
    // Set browser to Chrome
    ChromeOptions capability = new ChromeOptions();

    // Restrict to an OS platform if requested (ANY / VISTA / WIN10)
    capability.setCapability("platform", PLATFORM);

    // Create new remote webdriver session
    driver = new RemoteWebDriver(
            new URL("http://" + SELENIUM_HOST + ":" + SELENIUM_PORT + "/wd/hub"),
            capability);
我的Selenium网格中有以下节点,您可以看到VISTA和WIN10平台的值

如果我设置PLATFORM='ANY',我的测试运行时不会出现问题

但是,我需要在Windows 7和Windows 10中运行我的完整套件。当我通过VISTA或WIN10的值时,我的测试无法创建webdriver会话。以下是完整的输出:

session not created: No matching capabilities found
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'VDCW764DED019', ip: '172.16.216.46', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_181'
Driver info: driver.version: unknown
remote stacktrace: Backtrace:
 Ordinal0 [0x0031A903+1550595]
 Ordinal0 [0x0029A701+1025793]
 Ordinal0 [0x0021C6E5+509669]
 Ordinal0 [0x001CA698+173720]
 Ordinal0 [0x001CA9CA+174538]
 Ordinal0 [0x001CA8ED+174317]
 Ordinal0 [0x001C8CDB+167131]
 Ordinal0 [0x001B144A+70730]
 Ordinal0 [0x001B24D0+74960]
 Ordinal0 [0x001B2469+74857]
 Ordinal0 [0x002B42C7+1131207]
 GetHandleVerifier [0x003B70FD+523789]
 GetHandleVerifier [0x003B6E90+523168]
 GetHandleVerifier [0x003BE1E7+552695]
 GetHandleVerifier [0x003B78FA+525834]
 Ordinal0 [0x002AB7FC+1095676]
 Ordinal0 [0x002B633B+1139515]
 Ordinal0 [0x002B64A3+1139875]
 Ordinal0 [0x002B5425+1135653]
 BaseThreadInitThunk [0x7561343D+18]
 RtlInitializeExceptionChain [0x77A99802+99]
 RtlInitializeExceptionChain [0x77A997D5+54]
我尝试过使用DesiredCapabilities而不是ChromeOptions,但得到了相同的结果

private void setupRemoteDriver() throws MalformedURLException {
    // Set browser to Chrome

    DesiredCapabilities capability = DesiredCapabilities.chrome();

    // Restrict to an OS platform if requested (ANY / VISTA / WIN10)
    capability.setCapability("platform", PLATFORM);

    // Create new remote webdriver session
    driver = new RemoteWebDriver(
            new URL("http://" + SELENIUM_HOST + ":" + SELENIUM_PORT + "/wd/hub"),
            capability);
}

有人能帮忙吗

您可能需要更新浏览器的驱动程序version@KausUntwale,谢谢你的建议。我已经试过了,但仍然得到同样的结果。我的第一个想法可能是Chrome已经自动更新了。有一件事,尽管你的功能列表中有所有win10,但这仍然让我认为当你使用win7作为参数时,你没有正确的驱动程序。在32位操作系统上运行时,可能需要一个单独的32位驱动程序。