抛错信息:
D:\WorkSpaces\robot>robot TC_001_Start_Close_Broswer.robot
==============================================================================
TC 001 Start Close Broswer
==============================================================================
TC_001 Browser Start and Close
DevTools listening on ws://127.0.0.1:1885/devtools/browser/86104422-6664-46ca-8cc6-154a3b0d3b94
[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: WebDriverException: Message: chrome not reachable
(Session info: chrome=79.0.3945.79)
TC_001 Browser Start and Close | FAIL |
WebDriverException: Message: unknown error: cannot determine loading status
from disconnected: received Inspector.detached event
(Session info: chrome=79.0.3945.79)
------------------------------------------------------------------------------
TC 001 Start Close Broswer | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output: D:\WorkSpaces\robot\output.xml
Log: D:\WorkSpaces\robot\log.html
Report: D:\WorkSpaces\robot\report.html
D:\WorkSpaces\robot>
.robot 文件如下:
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${Browser} Chrome
${Url} http://www.google.com
*** Keywords ***
Open Browser
*** Test Cases ***
TC_001 Browser Start and Close
Open Browser
解决方法 :去掉 Keywords, 变成:
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${Browser} Chrome
${Url} http://www.google.com
*** Test Cases ***
TC_001 Browser Start and Close
Open Browser ${Url} ${Browser}
准备工作:
- 下载chromedriver.exe , 放到 python36 的script 文件夹下
- 安装robot , robot framework
pip install robot
pip install robotframework
参考文献
视频: https://www.bilibili.com/video/av40142101?p=3
官方文档: https://robotframework.org/#documentation