【问题标题】:Selenium chromedriver executable on Google Compute Engine virtual machine [duplicate]Google Compute Engine 虚拟机上的 Selenium chromedriver 可执行文件 [重复]
【发布时间】:2020-06-06 14:18:48
【问题描述】:

我正在尝试在 Google Compute Engine 上的虚拟机上运行 selenium 脚本。我有一台 debian-10-buster 机器。

我已经完成了pip3 install selenium,但是当我运行我的脚本时,我得到了这个错误:

selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

当我尝试在本地机器上设置 selenium 时,我看到了这个错误。我知道我需要下载 chromedriver 可执行文件并将其保存在虚拟机的路径中。但是,我一般不熟悉使用 Linux 和 SSH,所以我有两个问题:

  1. 如何在 google 虚拟机中下载 chromedriver 可执行文件?
  2. Google 虚拟机中的PATH 位置是什么?

感谢您与我分享的任何帮助!

【问题讨论】:

    标签: linux selenium ssh selenium-chromedriver google-compute-engine


    【解决方案1】:

    这是因为程序无法找到 chromedriver.exe 您需要从错误中提到的链接下载它,或者只是谷歌它。 然后你需要像这样专门定义它保存的路径:

    driver = webdriver.Chrome(executable_path=r"C:\Users\user\Downloads\chromedriver.exe")

    以上是在 Python 中完成的。

    【讨论】:

    • 是的,我知道我需要下载它。我需要知道如何通过 google 虚拟机中提供的 Linux SSH 接口下载它——我是使用虚拟机的新手,不知道该怎么做
    猜你喜欢
    • 2018-12-27
    • 2020-09-13
    • 2016-10-17
    • 2018-07-25
    • 2017-01-05
    • 2020-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多