【问题标题】:Use IE webdriver using selenium in python, without setting Security Modes在 python 中使用 selenium 使用 IE webdriver,无需设置安全模式
【发布时间】:2019-08-10 04:32:57
【问题描述】:

有没有办法在 Python 脚本中使用 selenium 来使用 IE webdriver,而无需在 IE 浏览器设置中为所有区域设置保护模式?

注意:场景是该组织确实允许您更改 IE 浏览器中的设置,因此我正在寻找解决方法。

我正在尝试下面的脚本,但出现错误:

"selenium.common.exceptions.SessionNotCreatedException: 消息:启动 Internet Explorer 时出现意外错误。所有区域的保护模式设置不同。启用保护模式必须设置为相同的值(启用或禁用)所有区域。 "

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

cap = DesiredCapabilities.INTERNETEXPLORER.copy()
cap['INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS'] = True
driver = webdriver.Ie(capabilities=cap, executable_path=r'C:\Users\Harsha\Videos\waterbox\IEDriverServer.exe')
driver.get('https://google.com') 

【问题讨论】:

  • 不,你没有其他选择
  • 更多详情见:linkedin.com/pulse/…
  • 当然,如果组织想要编写自动化并且需要更改 IE 设置,他们会例外。您可能只需要提出带有商业理由的正式请求。
  • 谢谢 Pritam Maske 和 Jeff,非常有帮助,我会听取您的建议!

标签: python selenium-webdriver internet-explorer-11 desiredcapabilities


【解决方案1】:

我同意 cmets 所说的。不允许您在 IE 中自动执行安全或其他重要设置。您可以做的是请求您的管理员授予允许您在 IE 中进行一些更改的权限。

【讨论】:

    猜你喜欢
    • 2014-10-15
    • 2017-02-22
    • 2019-01-09
    • 1970-01-01
    • 2022-01-02
    • 1970-01-01
    • 1970-01-01
    • 2017-09-17
    • 2017-08-12
    相关资源
    最近更新 更多