python - "Chrome not reachable"在非 headless 模式下使用 Xvfb

标签 python selenium google-chrome selenium-webdriver google-chrome-extension

我收到以下错误:

  File "/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
    self.execute(Command.GET, {'url': url})
  File "/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: chrome not reachable
  (Session info: chrome=80.0.3987.122)

当我尝试在不使用 --headless 选项并使用 xvfb 的情况下运行 Selenium Chromedriver 时。

在没有 xvfb 的情况下,它可以在 headless 模式下完美运行。我需要 xvfb,因为我需要它而不是 headless 模式来运行浏览器扩展,否则不支持。

为什么会这样?有什么办法可以实现我想要的吗?

最佳答案

确保 chrome 和 chromedriver 版本相同。

关于python - "Chrome not reachable"在非 headless 模式下使用 Xvfb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60450995/

相关文章:

python - Python setuptools 可以在 dist-packages 之外安装文件吗?

python - 循环访问 BeautifulSoup 中的元素,但仅输出该元素的子元素

java - 如何在 Selenium 中为我的网站发送 key

javascript - 如何在chrome浏览器扩展中执行javascript

jquery - onpopstate 事件不会在 Chrome/Safari 中触发

python - 两个 csv 文件之间的相似之处

python - 我可以在 wx.lib.plot.PlotCanvas 中获得类似 imshow() 的行为吗?

python - 从另一个运行 Python 脚本并传递变量和输出

javascript - 使用 JavaScript 从离开站点警报中获取文本?

html - 在 Chrome 中其他 flex 元素更改大小后,Div flex 元素滚动到顶部