ImportError: cannot import name ‘TouchActions‘ from ‘selenium.webdriver‘
最佳答案 问答题库568位专家为你答疑解惑
今天踩了一个坑:
需要使用selenium-wire抓取请求heads信息,直接用命令 pip install selenium-wire安装后,调试代码一直报cannot import name 'TouchActions' from 'selenium.webdriver'
开发环境:
selenium 版本4.11.2 (用 pip show selenium 查看版本)
selenium-wire版本 2.5.2 (用 pip selenium-wire 查看版本),用pip install selenium-wire命令没有指定版本号安装的
python 3.7
一步一步跟进问题:
1、在selenium-wire 的webdriver中有from selenium.webdriver import TouchActions,但是我安装的selenium 版本4.11.2已经不使用TouchActions了 只使用ActionChains,然后在网上搜索到的解决办法是 回退到selenium 3.141.0 (pip install selenium ==3.141.0),但是此办法不管用,报各种请求超时错误
2、既然selenium-wire版本 2.5.2使用TouchActions,而selenium 版本4.11.2不使用TouchActions,那么是否有selenium-wire某个版本不使用TouchActions了呢,通过在https://www.cnpython.com/pypi/seleniumwire网上找到最新的selenium-wire 5.1.0解决问题,此版本支持selenium 4+版本 pip install selenium-wire ==5.1.0
总结:
这种问题一般是版本不匹配导致,注意版本匹配即可
99%的人还看了
相似问题
- flink1.13.6版本的应用程序(maven版)
- 技术分享| gcc版本升级到5.2
- 基于 Glibc 版本升级的 DolphinDB 数据查询性能优化实践
- 解决requests 2.28.x版本SSL错误:证书验证失败
- UE5和UE4版本更新重大改变汇总。
- Docker build报错总结,版本过新大避雷!
- K8S1.23.5部署(此前1.17版本步骤囊括)及问题记录
- Mongodb3.4升级高版本mongoTemplate.executeCommand报错The cursor option is required
- onnx模型转换opset版本和固定动态输入尺寸
- centos安装指定版本docker
猜你感兴趣
版权申明
本文"ImportError: cannot import name ‘TouchActions‘ from ‘selenium.webdriver‘":http://eshow365.cn/6-16470-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!
- 上一篇: 总结三:计算机网络面经
- 下一篇: 【进阶C语言】排序函数(qsort)与模拟实现(回调函数的实例)