Python 无法使用chromedriver调用模块对象
我试图使用python/selenium在一个特定的URL上打开chrome,但我一直得到一个TypeError:Module object not found错误。我试着查找我做错了什么,但没有发现任何帮助。 代码: 输出:Python 无法使用chromedriver调用模块对象,python,selenium,module,selenium-chromedriver,typeerror,Python,Selenium,Module,Selenium Chromedriver,Typeerror,我试图使用python/selenium在一个特定的URL上打开chrome,但我一直得到一个TypeError:Module object not found错误。我试着查找我做错了什么,但没有发现任何帮助。 代码: 输出: Traceback (most recent call last): File "/home/matthew/Desktop/scraper.py", line 5, in <module> driver = wb.chrome
Traceback (most recent call last):
File "/home/matthew/Desktop/scraper.py", line 5, in <module>
driver = wb.chrome(PATH)
NameError: name 'wb' is not defined
[Finished in 0.1s with exit code 1]
[shell_cmd: python -u "/home/matthew/Desktop/scraper.py"]
[dir: /home/matthew/Desktop]
[path: /home/matthew/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games]
回溯(最近一次呼叫最后一次):
文件“/home/matthew/Desktop/scraper.py”,第5行,在
驱动程序=wb.chrome(路径)
NameError:未定义名称“wb”
[在0.1s内完成,退出代码为1]
[shell\u cmd:python-u”/home/matthew/Desktop/scraper.py“]
[dir:/home/matthew/Desktop]
[路径:/home/matthew/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games]
尝试将chromedriver放入“C:\chromedrive”我发现我使用的是.chrome而不是.chrome,这就是引发错误的原因,谢谢。尝试将driver=webdriver.chrome(PATH)
更改为driver=webdriver.chrome(FULL/PTH)
什么确保OP使用Windows?
Traceback (most recent call last):
File "/home/matthew/Desktop/scraper.py", line 5, in <module>
driver = wb.chrome(PATH)
NameError: name 'wb' is not defined
[Finished in 0.1s with exit code 1]
[shell_cmd: python -u "/home/matthew/Desktop/scraper.py"]
[dir: /home/matthew/Desktop]
[path: /home/matthew/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games]