0
点赞
收藏
分享

微信扫一扫

Traceback (most recent call last) 无法定位到元素python+selenium

做个橙梦 2022-02-14 阅读 126


Traceback (most recent call last)?​​TOC​​

#selenium.common.exceptions.InvalidArgumentException: Message: Expected [object Undefined] undefined

python+selenium 运行报错,定位元素的方法都正确,但就是找不到元素,

Traceback (most recent call last) 无法定位到元素python+selenium_运行报错

下面是解决办法

查看项目配置

Traceback (most recent call last) 无法定位到元素python+selenium_python安装_02

这里提示selenium可以升级

打开dos窗口

先找到python的安装路径

Traceback (most recent call last) 无法定位到元素python+selenium_python安装_03

进入到python安装路径

Traceback (most recent call last) 无法定位到元素python+selenium_python安装_04

查看目前安装的工具 pip list

Traceback (most recent call last) 无法定位到元素python+selenium_python安装_05

发现selenium不是最新版,把它卸载掉pip uninstall selenium

Traceback (most recent call last) 无法定位到元素python+selenium_运行报错_06

Traceback (most recent call last) 无法定位到元素python+selenium_python_07

再查看,已经卸载成功

Traceback (most recent call last) 无法定位到元素python+selenium_运行报错_08

安装指定版本的selenium

pip install selenium==4.0.0a1Traceback (most recent call last) 无法定位到元素python+selenium_运行报错_09

查看已经安装成功

Traceback (most recent call last) 无法定位到元素python+selenium_运行报错_10

Traceback (most recent call last) 无法定位到元素python+selenium_python安装_11现在再运行脚本,就没有问题了。



举报

相关推荐

0 条评论