【问题标题】:How to route selenium webdriver to the right node in the grid?如何将 selenium webdriver 路由到网格中的正确节点?
【发布时间】:2015-07-01 11:34:44
【问题描述】:

假设我在同一个网格上有 2 个节点: 一个是 FF 的 1 个实例,另一个是 android 设备。 在我的测试中,我使用了 2 个驱动程序:一个用于 FF,另一个用于 android。如果网格的节点与驱动初始化的顺序不一致,会报错:

"org.openqa.selenium.WebDriverException: 驱动的路径 可执行文件必须由 webdriver.ie.driver 系统属性设置;"。

所以问题是我如何告诉驱动程序路由到正确的节点?

【问题讨论】:

    标签: java android node.js selenium grid


    【解决方案1】:

    尝试使用 DesiredCapabilities。这是一个例子:

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setPlatform(platform); 
    // available platforms: {WINDOWS|XP|VISTA|MAC|LINUX|UNIX|ANDROID}
    capabilities.setBrowserName(browser); 
    // browser types: {android|chrome|firefox|htmlunit|internet explorer|iPhone|iPad|opera|safari}
    
    driver = new RemoteWebDriver(new URL(config.get("selenium.hub")), capabilities); 
    // just URL to hub and your capabilities
    

    通过设置平台和浏览器,您可以指定到节点的路由;)

    【讨论】:

      【解决方案2】:

      我认为这与将 selenium 路由到正确的节点没有任何关系。集线器会根据所需的功能自动匹配节点与传入请求。

      我在这里看到的问题与“webdriver.ie.driver”明确相关。您尝试在设置此参数之前实例化 IE 驱动程序。仔细检查您正在实例化正确的驱动程序类 - 您需要 FF 和 android,而不是 IE。

      【讨论】:

        猜你喜欢
        • 2017-06-21
        • 1970-01-01
        • 1970-01-01
        • 2021-12-19
        • 1970-01-01
        • 2017-10-11
        • 1970-01-01
        • 2016-06-08
        • 1970-01-01
        相关资源
        最近更新 更多