python - (Python/Conda) 安装和导入 Firefox 11 兼容的 selenium 版本
问题描述
我一直试图让 Selenium 与 Firefox 11 一起工作,但没有成功。conda (3.141.0) 中可用的当前版本与 Firefox 11 不兼容;当我尝试创建不同的环境并下载 Selenium 2.53.5(我相信它可以与 FF 11 一起使用)时,它不会让我将模块导入到 .py 文件、python REPL 或 ipython。错误:
康达清单:
#
# Name Version Build Channel
certifi 2018.8.24 py35_1001 conda-forge
pip 20.1.1 py_1 conda-forge
python 3.5.5 he025d50_2 conda-forge
selenium 2.53.5 py35_0 conda-forge
setuptools 40.4.3 py35_0 conda-forge
vc 14.1 h869be7e_1 conda-forge
vs2015_runtime 14.16.27012 h30e32a0_2 conda-forge
wheel 0.34.2 py_1 conda-forge
wincertstore 0.2 py35_1002 conda-forge
Python REPL:
Python 3.5.5 | packaged by conda-forge | (default, Jul 24 2018, 01:52:17) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import selenium
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'selenium'
为什么会这样?
不幸的是,我只能使用 Firefox v11(由于某些专有的 Java 公司代码无法在更高版本上运行)。
我应该使用哪个 selenium/conda/python/selenium 版本以及如何安装/导入它们?谢谢!
解决方案
你正在穿越到 2012 年,所以这会很困难。我浏览了发行说明,发现 Selenium 2.21 提到了 Firefox 11,所以它是兼容的。
您应该能够在 requirements.txt 文件中指定版本。如果您无法启动浏览器,您可能想尝试一个大约相同年龄的 python 版本,也许从 python 2 的最后一个版本开始并向后工作。
https://github.com/SeleniumHQ/selenium/blob/master/java/CHANGELOG#L2237
推荐阅读
- javascript - 重新渲染反应后点击事件丢失(由模糊事件引起)
- c# - 项目总是编译但很少成功发布到 IIS
- python - Python用逗号和引号分解字符串
- php - 我该如何解决这个错误?找不到类“App\Department”(查看:E:\proiecte\HRmanagement-app\resources\views\admin\user\create.blade.php)
- php - 无法与主机 eoptronic.com 建立连接:stream_socket_client():
- html - 我如何在 XML 中引用?
- apache-camel - 如何让应用程序的一个实例只接收每个 AMQP 主题消息(消费者组行为)
- azure - Azure 应用程序网关:无法连接到后端服务器
- javascript - 动画完成后如何删除css类?反应
- azure-devops - 使用 azure devops 自动发布