【问题标题】:Opera browser in Selenium grid: Driver class not foundSelenium 网格中的 Opera 浏览器:找不到驱动程序类
【发布时间】:2017-04-07 12:04:42
【问题描述】:

我正在尝试使用 Selenium 网格设置环境以在远程机器上执行我的 Selenium 测试。我唯一无法使用的浏览器是 Opera。我将其配置为与其他浏览器相同。但是,当我启动节点时,它显示找不到驱动程序类。

我正在我的主机上运行 windows 8.1 Enterprise 64 位

节点和主机在windows 7 Enterprise 32 bit service pack 1上

在主机上安装opera,opera webdriver在C:/GUI-Tests/Drivers/operadriver.exe,我试了32位webdriver和64位webdriver,还是报错:

13:30:37.169 INFO - Driver class not found: com.opera.core.systems.OperaDriver
13:30:37.169 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped: Unable to create new instances on this machine.
13:30:37.178 INFO - Driver class not found: com.opera.core.systems.OperaDriver
13:30:37.178 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered

如果有人知道这个问题,请帮助我。


关于我的环境的额外信息

启动集线器:

java -jar selenium-server-standalone-3.3.1.jar -role hub -hubConfig hubConfig.json

我的 Hub 配置:

{
  "host": ip,
  "maxSessions": 5,
  "port": 4444,
  "cleanupCycle": 5000,
  "timeout": 300000,
  "newSessionWaitTimeout": -1,
  "servlets": [],
  "prioritizer": null,
  "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
  "throwOnCapabilityNotPresent": true,
  "nodePolling": 180000,
  "platform": "WINDOWS"
}

启动节点:

java -jar selenium-server-standalone-3.3.1.jar -role node -nodeConfig nodeConfig.json

我的节点配置文件:

{
  "capabilities":
  [
    {
      "browserName": "opera",
      "platform": "WINDOWS",
      "maxInstances": 5,
      "seleniumProtocol": "WebDriver",
      "webdriver.opera.driver": "C:/GUI-Tests/Drivers/operadriver.exe"
    }
  ],
  "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
  "maxSession": 1,
  "port": 5555,
  "register": true,
  "registerCycle": 5000,
  "hub": "http://localhost:4444",
  "nodeStatusCheckTimeout": 5000,
  "nodePolling": 5000,
  "role": "node",
  "unregisterIfStillDownAfter": 60000,
  "downPollingLimit": 2,
  "debug": false,
  "servlets" : [],
  "withoutServlets": [],
  "custom": {}
}

驱动程序位置的屏幕截图:

【问题讨论】:

    标签: selenium selenium-webdriver selenium-grid


    【解决方案1】:

    回答我自己的问题,因为我发现了答案,我希望能帮助所有在这个问题上谷歌的人:)

    原来 opera 驱动程序是旧版驱动程序,您不需要它。

    您确实需要 Opera 浏览器和operachromiumdriver。在 c# 中将您的功能定义为:

    capabilities = new DesiredCapabilities();
    capabilities.SetCapability(CapabilityType.BrowserName, "operablink");
    capabilities.Platform = new Platform(PlatformType.Windows);
    _webDriver = new RemoteWebDriver(_gridServerUri, capabilities);
    

    在您的节点上:

    {
      "capabilities":
      [
        {
          "browserName": "operablink",
          "platform": "WINDOWS",
          "maxInstances": 5,
          "seleniumProtocol": "WebDriver"
        }
      ],
      "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
      "maxSession": 1,
      "port": 5555,
      "register": true,
      "registerCycle": 5000,
      "hub": "http://localhost:4444",
      "nodeStatusCheckTimeout": 5000,
      "nodePolling": 5000,
      "role": "node",
      "unregisterIfStillDownAfter": 60000,
      "downPollingLimit": 2,
      "debug": false,
      "servlets" : [],
      "withoutServlets": [],
      "custom": {}
    }
    

    我希望这对某人有用,至少对我有用。

    注意:

    • operachromiumdriver 在我的路径变量中
    • 我的节点和集线器运行的是 Windows 7

    【讨论】:

    • 这对我很有帮助。我只使用了 browserName: 'opera' 并没有用,但有了你的能力,它也对我有用
    • 对我来说,问题中的节点配置运行良好。我唯一改变的是我删除了代理密钥并将驱动程序设置为“operadriver.exe”,没有任何前缀。然后在我的测试目录中创建命令提示符的快捷方式以启动,并使用 /k 开关启动节点/k java -jar selenium.jar -role node -nodeConfig nodeconfig.json
    猜你喜欢
    • 2021-11-27
    • 1970-01-01
    • 1970-01-01
    • 2014-09-03
    • 1970-01-01
    • 2012-01-16
    • 2023-02-16
    • 1970-01-01
    • 2016-12-16
    相关资源
    最近更新 更多