[英]Error in launching IE with Python-Selenium while the exact same script works fine with Java-Selenium
I get the following error when I try to launch the Internet explorer using Selenium.当我尝试使用 Selenium 启动 Internet Explorer 时出现以下错误。
My code is:我的代码是:
from selenium import webdriver
driver = webdriver.Ie('C:\\workspace\\IEDriverServer.exe')
driver.get("http://wwww.facebook.com")
The error I get is我得到的错误是
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.
Combination that does not work: Python/PyCharm while the combination that works : Java/Eclipse无效的组合:Python/PyCharm 而有效的组合:Java/Eclipse
IE explorer driver is the same single file in both cases.在这两种情况下,IE 资源管理器驱动程序都是同一个文件。 It is on same PC
它在同一台电脑上
You need to explicitly tell the IE driver to ignore the protected mode settings.您需要明确告诉 IE 驱动程序忽略保护模式设置。
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
caps = DesiredCapabilities.INTERNETEXPLORER
caps['ignoreProtectedModeSettings'] = True
driver = webdriver.Ie('C:\\workspace\\IEDriverServer.exe', capabilities=caps)
driver.get("http://wwww.facebook.com")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.