如何忽略缩放设置

2024-04-16 15:21:07 发布

您现在位置:Python中文网/ 问答频道 /正文

IE忽略缩放设置不起作用,我的代码如下,为什么不起作用?我收到了错误信息(selenium.common.异常.SessionNotCreatedException:消息:启动Internet Explorer时出现意外错误。浏览器缩放级别设置为125%。应设置为100%)

from selenium.webdriver import Ie
from selenium.webdriver.ie.options import Options
opts = Options()
opts.ignore_protected_mode_settings = True
driver = Ie(options=opts)

Tags: 代码fromimport消息seleniumcommoninternetie
1条回答
网友
1楼 · 发布于 2024-04-16 15:21:07

,使用InternetExplorerDriver时,不应忽略浏览器缩放设置。在

根据InternetExplorerDriver的官方文档,^{}提到了关于浏览器缩放级别的以下内容

The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.

由于浏览器缩放级别设置为125%,因此您会看到错误。作为解决方案,您必须将浏览器缩放级别设置回100%。在


更新

虽然您没有回复/评论我的答案,我从您的问题更新可以看到,您试图设置属性忽略保护模式设置。要实现这一点,您需要使用DesiredCapabilities()类的实例,并按如下方式配置WebDriver实例:

^{pr2}$

相关问题 更多 >