Selenium+python自动化测试:解决无法启动IE浏览器及报错问题

🍅 点击文末小卡片,免费获取软件测试全套资料,资料在手,涨薪更快

前言:记录启动IE浏览器的报错及解决方法。

错误1:

selenium.common.exceptions.WebDriverException: Message: 'IEDriverServer.exe' executable needs to be in PATH. Please download from http://selenium-release.storage.googleapis.com/index.html and read up at https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver

Exception ignored in: <bound method Service.del of <selenium.webdriver.ie.service.Service object at 0x000001541A09C1D0>>

解决方法:

根据以上报错提示,点击蓝色链接,下载IEDriverServer.exe ,这里需要注意的是,所下载的IEDriverServer要与selenium版本保持一致!!!

(1)查看selenium版本

打开cmd,输入命令:pip show selenium,可以查看到版本号为2.53.6

(2)下载IEDriverServer.exe

点击报错链接或直接在浏览器输入:http://selenium-release.storage.googleapis.com/index.html,根据selenium对应版本进行下载。

根据需要下载32位或64位

将下载完成后的压缩包解压,并将其放置python文件夹下即可。

错误2:

WebDriverException: Message: u'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.'

解决方法:

在IE浏览器的 设置>internet选项>安全 下 ,将四个区域中启用保护模式的勾选状态取消,应用并确定。

错误3:

selenium.common.exceptions.WebDriverException: Message: Unexpected error launching Internet Explorer. Browser zoom level was set to 150%. It should be set to 100%

解决方法:

修改浏览器缩放比例为100%即可。

问题4:

在ie上执行程序,点击的是"确定"按钮,触发的却是"取消"按钮的效果。(ps:其他浏览器都正常执行,就IE不对)name定位、css定位、xpath文本定位能试的都试了,可还是如此。还没解决,要是哪位大佬看到,请在评论区指点迷津~非常感谢!下面附上代码和效果:

1、定位截图

2、代码截图:

3、运行结果:(点击确定后则新建成功,弹框关闭;点击取消才是如下结果)

最后感谢每一个认真阅读我文章的人,礼尚往来总是要有的,虽然不是什么很值钱的东西,如果你用得到的话可以直接拿走:

这些资料,对于做【软件测试】的朋友来说应该是最全面最完整的备战仓库,这个仓库也陪伴我走过了最艰难的路程,希望也能帮助到你!凡事要趁早,特别是技术行业,一定要提升技术功底。

相关推荐
孟健6 小时前
Karpathy 用 200 行纯 Python 从零实现 GPT:代码逐行解析
python
码路飞8 小时前
写了个 AI 聊天页面,被 5 种流式格式折腾了一整天 😭
javascript·python
曲幽10 小时前
FastAPI压力测试实战:Locust模拟真实用户并发及优化建议
python·fastapi·web·locust·asyncio·test·uvicorn·workers
敏编程15 小时前
一天一个Python库:jsonschema - JSON 数据验证利器
python
前端付豪15 小时前
LangChain记忆:通过Memory记住上次的对话细节
人工智能·python·langchain
databook15 小时前
ManimCE v0.20.1 发布:LaTeX 渲染修复与动画稳定性提升
python·动效
花酒锄作田1 天前
使用 pkgutil 实现动态插件系统
python
前端付豪1 天前
LangChain链 写一篇完美推文?用SequencialChain链接不同的组件
人工智能·python·langchain
曲幽1 天前
FastAPI实战:打造本地文生图接口,ollama+diffusers让AI绘画更听话
python·fastapi·web·cors·diffusers·lcm·ollama·dreamshaper8·txt2img
老赵全栈实战1 天前
Pydantic配置管理最佳实践(一)
python