【问题标题】:Launch Safari on Mac node from Windows PC with Selenium RemoteWebDriver and Grid使用 Selenium RemoteWebDriver 和 Grid 从 Windows PC 在 Mac 节点上启动 Safari
【发布时间】:2016-06-16 15:50:33
【问题描述】:

我正在尝试从我的 Windows PC 对我的 iMac 进行测试。

我已经下载并安装了 Safari 的 webdriver 插件,并且我已经建立了与基于 Windows 的 Selenium Grid 集线器的连接。

当我尝试运行我的测试时,我收到一个 OperaDriver 错误:

org.openqa.selenium.WebDriverException:最佳匹配驱动程序提供程序 org.openqa.selenium.opera.OperaDriver 无法为 Capabilities [{browserName=safari, safari.options={port=0, cleanSession=true},版本=9,平台=MAC}]

当前设置:

Windows 电脑:

java -jar selenium-server-standalone-2.53.0.jar -role hub -port 4445

苹果机:

java -jar selenium-server-standalone-2.53.0.jar -role node -nodeConfig node1Config.json

node1Config:

{
"capabilities": [
    {
        "browserName": "safari",
        "acceptSslCerts": true,
        "javascriptEnabled": true,
        "takeScreenshot": false,
        "browser-version": "9",
        "platform": "MAC",
        "maxInstances": 5,
        "cleanSession": true
    }
],
"configuration": {
    "_comment": "Configuration for Node",
    "cleanUpCycle": 2000,
    "timeout": 30000,
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
    "port": 5568,
    "hubHost": "MyNetworkIpWasHere",
    "register": true,
    "hubPort": 4445,
    "maxSessions": 5
    }   
}

Java 启动测试:

DesiredCapabilities capabilities = DesiredCapabilities.safari();
capabilities.setPlatform(Platform.MAC);
capabilities.setBrowserName("safari");
capabilities.setVersion("9");

webDriver = new RemoteWebDriver(new URL("http://myipwashere:4445/wd/hub"), capabilities);

编辑:我的网格上有 5 个 safari 节点可用,没有一个正在使用。

我一定忽略了一些东西,任何帮助将不胜感激!

提前致谢。

【问题讨论】:

  • 检查 localhost:4444 并检查是否有可用的 Safari 节点
  • 谢谢,但目前我的网格中有 5 个没有被使用。
  • 很好,这意味着节点和集线器设置正确。您可以尝试从您的代码中删除 capabilities.setVersion("9"); 吗?该错误告诉您您正在使用的功能与节点的功能不匹配。
  • 不幸的是,这并没有做任何事情。这可能是一个愚蠢的问题,但为什么它会为 OperaDriver 而不是 Safari 提供错误?

标签: selenium selenium-webdriver safari selenium-grid safaridriver


【解决方案1】:

经过反复试验,传递给 remotewebdriver 的 URL 仅对 Safari 不正确。希望这将有助于将来遇到类似问题的人。

感谢 RemcoW 的所有帮助。

【讨论】:

  • 请解释并提供您最终使用的网址。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-07-30
  • 1970-01-01
  • 2015-01-15
  • 1970-01-01
  • 2014-10-22
  • 1970-01-01
相关资源
最近更新 更多