在安裝完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
---恢復內容結束---