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

时间:2017-01-09 11:04:04   收藏:0   阅读:5208

通过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

 

原文:http://www.cnblogs.com/fangfangs/p/6264190.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!