您的位置:首页 > 其它

selenium webdriver启动IE浏览器失败的解决办法

2017-01-09 10:16 906 查看
通过selenium webdriver启动IE浏览器失败,报错:selenium.common.exceptions.WebDriverException: 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.
解决办法:修改浏览器安全设置---工具-Internet选项-安全-(Internet/本地Internet/受信任的站定/受限制的站点)启用保护模式全部勾选或全部去掉勾选。

然后运行脚本出现如下问题:



selenium.common.exceptions.WebDriverException: Message: Failed to navigate to http://www.baidu.com. This usually means that a call to the COM method IWebBrowser2::Navigate2() failed.

解决办法:在生成webdriver对象之前,用脚本修改浏览器配置:

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
DesiredCapabilities.INTERNETEXPLORER["ignoreProtectedModeSettings"] = True
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐