robot framework - 使用selenium grid启动远程浏览器时出错

时间:2017-05-18 16:43:55

标签: python python-2.7 selenium robotframework

第一次在这里发帖,如果我遗漏任何细节,请原谅我。

我使用以下设置:
机器人框架:3.0.1(Python 2.7.10)
硒:3.4.1
selenium2library:1.4.1

我有一台mac机器配置为网格集线器,另一台mac机器配置为节点。

这是我的RF测试:

Open Browser    url=http://www.google.com    browser=firefox    remote_url=http://hub-server:4444/wd/hub    desired_capabilities=browser:firefox
Maximize Browser Window

我只是试图在其他计算机上打开浏览器以使其正常工作但是在尝试执行脚本时出现以下错误:

KeyError:' desiredCapabilities'

当我将测试更改为:

Open Browser    url=http://www.google.com    browser=firefox    remote_url=http://hub-server:4444/wd/hub    desiredCapabilities=browser:firefox
Maximize Browser Window

我收到此错误:

Keyword' Selenium2Library.Open Browser'在命名参数后得到位置参数。

我用Google搜索了https://github.com/SeleniumHQ/selenium/issues/3808,但我不确定这是否与我的问题有关。任何帮助深表感谢。谢谢!

1 个答案:

答案 0 :(得分:0)

根据文档,关键字为desired_capabilities,而非desiredCapabilities

  

如果为remote指定值,则还可以指定'desired_capabilities',它是key1:val1,key2:val2形式的字符串,用于指定远程服务器的desired_capabilities。这对于为Internet Explorer指定代理服务器或指定浏览器和操作系统(如果使用saucelabs.com)非常有用。 'desired_capabilities'也可以是一个dictonary(用'Create Dictionary'创建),以允许更复杂的配置。