Robot Framework 自动化测试部署常见问题及处理方法(二)

发布时间 2023-08-17 14:40:26作者: TotheAnts

书接上文

4.使用Open Browser关键字打开浏览器报错“WebDriverException: Message: 'geckodriver' executable needs to be in PATH.”,如图: 

 

原因:

缺少WebDriver
 

解决办法:

官网地址:https://pypi.org/project/selenium/,滑动到如下页面,下载对应浏览器版本Drivers(此处演示火狐浏览器下载步骤)

 

 

下载解压后,放到python根目录下即可(各浏览器WebDriver名称不同,火狐叫:geckodriver)

 

⑵ 谷歌浏览器

驱动下载地址: https://registry.npmmirror.com/binary.html?path=chromedriver/ 或 https://chromedriver.chromium.org/downloads

 

⑶ IE浏览器

WebDriver下载注意:
必须先查看selenium版本

 

打开https://npm.taobao.org/mirrors/,选择selenium

 

下载对应selenium的版本

 

设置IE浏览器安全模式,建议都不启用,否则可能有其他问题

 

5.使用Open Browser关键字打开浏览器报错“InvalidArgumentException: Message: Malformed URL: URL constructor: www.baidu.com is not a valid URL.”,如图:

 

原因:

web请求中地址未添加协议
 

解决办法:

添加完整协议即可,如图:

 

6.Tools>Preferences>Grid Editor打不开,无法设置【Edit】标签下表格宽度(表格宽度极小,无法编写脚本)

原因:

python版本问题
 

解决办法:

建议安装python3.7.5
 

7.调用IE浏览器报错“SessionNotCreatedException: Message: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones.”,如图:

 

原因:

IE浏览器安全模式不统一,建议都不启用,否则可能有其他问题
 

解决办法: