小编Saf*_*Saf的帖子

Selenium Webdriver Chrome 在云功能上失败

我正在尝试在 Cloud Function 上使用 selenium webdriver chrome 运行一个简单的代码。我收到以下错误

消息:'chromedriver' 可执行文件需要在 PATH 中。请参阅https://sites.google.com/a/chromium.org/chromedriver/home

如何在 Cloud Function 中指定 chromedriver 可执行文件?

下面是我的代码

from selenium import webdriver
import time
def test_webdriver(event=None, context=None):
    driver = webdriver.Chrome()
    driver.get('http://www.google.com/');
    time.sleep(5)
    search_box = driver.find_element_by_name('q')
Run Code Online (Sandbox Code Playgroud)

python selenium-chromedriver google-cloud-platform google-cloud-functions

6
推荐指数
1
解决办法
1292
查看次数