Python Internet Explorer WebDriver不支持';t在robot框架中启动

Python Internet Explorer WebDriver不支持';t在robot框架中启动,python,internet-explorer,selenium,selenium-webdriver,robotframework,Python,Internet Explorer,Selenium,Selenium Webdriver,Robotframework,我在robot框架中运行了一些测试,这些测试在firefox和chrome上运行良好,但在InternetExplorer上运行不好。我读过其他帖子,其中建议将安全级别设置为protected,我确实这样做了 但是我得到了以下错误: WebDriverException: Message: Unexpected error launching Internet Explorer. Mode must be set to the same value (enabled or disabled) f

我在robot框架中运行了一些测试,这些测试在firefox和chrome上运行良好,但在InternetExplorer上运行不好。我读过其他帖子,其中建议将安全级别设置为protected,我确实这样做了

但是我得到了以下错误:

WebDriverException: Message: Unexpected error launching Internet Explorer.
Mode must be set to the same value (enabled or disabled) for all zones.
webdriver.py文件:

DEFAULT_TIMEOUT = 30
DEFAULT_PORT = 0
DEFAULT_HOST = None
DEFAULT_LOG_LEVEL = None
DEFAULT_LOG_FILE = None

class WebDriver(RemoteWebDriver):

    def __init__(self, executable_path='IEDriverServer.exe', capabilities=None,
                 port=DEFAULT_PORT, timeout=DEFAULT_TIMEOUT, host=DEFAULT_HOST,
                 log_level=DEFAULT_LOG_LEVEL, log_file=DEFAULT_LOG_FILE):
        self.port = port
        if self.port == 0:
            self.port = utils.free_port()
        self.host = host
        self.log_level = log_level
        self.log_file = log_file

        self.iedriver = Service(executable_path, port=self.port,
             host=self.host, log_level=self.log_level, log_file=self.log_file)

        self.iedriver.start()

        if capabilities is None:
            capabilities = DesiredCapabilities.INTERNETEXPLORER

        RemoteWebDriver.__init__(
            self,
            command_executor='http://localhost:%d' % self.port,
            desired_capabilities=capabilities)
        self._is_remote = False

    def quit(self):
        RemoteWebDriver.quit(self)
        self.iedriver.stop()
我是否也应该更改其他浏览器的安全级别?还是有其他办法解决这个问题?提前谢谢


以上应该回答您的问题,您不需要更改所有其他浏览器的安全级别。这不仅仅是启用保护模式,这是您的问题,而是我想象的不同区域的安全级别不同,即internet/intranet

我了解到我需要忽略保护模式设置

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

caps = DesiredCapabilities.INTERNETEXPLORER
caps['ignoreProtectedModeSettings'] = True

driver = webdriver.Ie(capabilities=caps)

尝试在IE浏览器的受信任站点中添加URL。这对我有用。我尝试了我找到的所有选项,但最终将URL添加到受信任的站点成功了。确保添加了正确的URL(我指的是https/http,任何在IE中手动打开的内容)。希望这有帮助。

请按照以下步骤操作,这些步骤可能会解决您的大部分问题。从第1步开始如果浏览器具有代理设置,则可以从第3步开始

1.我已在IE中启用代理

2.在启动浏览器之前(即开始执行testcase之前)将环境变量no_proxy设置为127.0.0.1例如:设置环境变量no_proxy 127.0.0.1

3.将所有internet区域设置为相同级别(中到高)受限制站点除外打开浏览器>工具>internet选项>安全选项卡


4.在所有区域中启用“启用受保护模式”

当我在同一浏览器中将所有区域设置为同一级别时,这不起作用。我还需要Python的解决方案。谢谢你这个问题的答案与语言无关,因为它是解决你问题的方法,它完全与你的浏览器设置有关。是否已在所有区域将保护模式启用/禁用设置为与错误消息建议的相同值?我记得在我抛出错误时,出现了一些奇怪的行为,需要重新打开IE并设置几次值。所有区域的级别都相同,但启用/禁用的保护模式不相等!我必须要求我的管理员更改此项。希望您能够通过管理员对其进行排序。在这种情况下,您能接受答案吗?