设为首页 加入收藏

TOP

python遇到使用selenium的问题(二)
2023-07-23 13:35:46 】 浏览:50
Tags:python selenium
继续运行原来的命令,又会遇到新的以下的问题

/usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.12) or chardet (3.0.4) doesn't match a supported version!
  warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
crawl.py:29: DeprecationWarning: use options instead of chrome_options
  driver = webdriver.Chrome(chrome_options = chrome_options)
Traceback (most recent call last):
  File "crawl.py", line 29, in <module>
    driver = webdriver.Chrome(chrome_options = chrome_options)
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/chromium/webdriver.py", line 92, in __init__
    super().__init__(
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 272, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 364, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 429, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/errorhandler.py", line 243, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

找不到chrome binary,这种情况一般是浏览器对应的驱动没有再默认路径下找到浏览器的二进制文件。

首先我们检查到主机上就没有安装谷歌浏览器

parallels@parallels-Parallels-Virtual-Platform:~/BlackWidow$ chromium-browser -version
Command 'chromium-browser' not found, but can be installed with:
sudo apt install chromium-browser
1. parallels@parallels-Parallels-Virtual-Platform:~/BlackWidow$ sudo apt install chromium-browser
2. 将之前下载的文件移动到该路径/usr/bin,命令: sudo mv chromedriver /usr/bin
3. 切换到/usr/bin目录,命令: cd /usr/bin
4. 使得其变成可执行文件,命令 :sudo chmod a+x chromedriver

最后再执行工具命令就可以了

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇nginx访问控制,用户认证,配置ht.. 下一篇2022年安装fedora workstation 36..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目