模块对象不可使用chromedriver调用



我试图使用python/selenium在特定的URL上打开chrome,但我一直收到TypeError:Module object not found错误。我试着查找我做错了什么,但没有发现任何帮助。代码:


from selenium import webdriver 
PATH = "/home/matthew/chromedriver"
driver = webdriver.chrome(PATH)
driver.get("google.com")

输出:

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]

我发现我用了.chrome而不是.chrome,这就是导致错误的原因,谢谢。

尝试将driver = webdriver.chrome(PATH)更改为driver = webdriver.Chrome(FULL/PTH)

尝试将chromedriver放入"C: \chromedrive";

相关内容

  • 没有找到相关文章

最新更新