用 python 和自制软件安装硒



我已经将Selenium下载到我的Mac上。我正在尝试使用硒在 python 中运行脚本,但出现错误:

Traceback (most recent call last):
File "selenium.py", line 3, in <module>
    from selenium import webdrive
File "/Users/shynds23/python/selenium.py", line 3, in <module>
    from selenium import webdriver
ImportError: cannot import name webdriver

我的脚本有这些标题:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
import time

关于如何解决它的任何想法?

尝试使用 pip 下载硒:

pip install selenium

如果您的机器上未安装 pip,请运行:

python get-pip.py

这是get-pip的链接:

https://bootstrap.pypa.io/get-pip.py

最新更新