在安装完robot framework之后,编写了打开浏览器的用例,但是在打开浏览器的步骤一直报错
问题原因是,虽然下载了selenuim,但是并没有浏览器driver,所以还要单独下载浏览器driver放在path的路径下(如c:python27,c:python27/scripts),这样就可以直接调起来了
selenium3.0发布以后,在3.0里不再有 Firefox 的驱动了,Mozilla 也把 Firefox 的 driver 独立发布出来了,而这个 driver 就是 geckodriver 了
所以我把selenium升级到3.0,终于把火狐浏览器掉起来了,成功~~撒花~~~
selenium升级方法:用cmd的pip命令查看现在可以升级的包,看到里面有selenium,然后用pip命令升级
具体问题:
1 command: pybot.bat --argumentfile c:\users\yangya~1\appdata\local\temp\RIDEvud5bz.d\argfile.txt --listener C:\Python27\lib\site-packages\robotide\contrib\testrunner\TestRunnerAgent.py:60343:False E:\ride项目文件夹\客户端弹窗.robot 2 ================================================================================================================= 3 客户端弹窗 4 ================================================================================================================= 5 use_ticket | FAIL | 6 WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home 7 ----------------------------------------------------------------------------------------------------------------- 8 客户端弹窗 | FAIL | 9 1 critical test, 0 passed, 1 failed 10 1 test total, 0 passed, 1 failed 11 ================================================================================================================= 12 Output: c:\users\yangya~1\appdata\local\temp\RIDEvud5bz.d\output.xml 13 14 [ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: No browser is open 15 Log: c:\users\yangya~1\appdata\local\temp\RIDEvud5bz.d\log.html 16 Report: c:\users\yangya~1\appdata\local\temp\RIDEvud5bz.d\report.html 17 18 Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.chrome.service.Service object at 0x0000000003E37668>> ignored 19 20 test finished 20170315 20:19:56
解决问题1:
"'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.chrome.service.Service object at 0x0000000003E37668>> ignored
解决办法:
说明是浏览器驱动器没有安装,点击上面的网址安装谷歌浏览器的驱动器,并设置好驱动器的路径到环境变量PATH中去。
我因为之前设置过Python的环境变量:D:\Python27,所以这里直接把下载的chromedriver.exe复制到D:\Python27目录下即可,不用额外再设置了。
分享个链接:http://pan.baidu.com/s/1eSabNH4
---恢复内容结束---