【发布时间】:2019-06-17 01:37:23
【问题描述】:
我想通过 gecko 驱动在 Google Colab 中运行 selenium,但它告诉我:可执行文件需要在 PATH 中
我在 Google Colab 中上传了 firefox 和 gecko 驱动程序,并复制了 gecko 驱动程序的路径。该代码在我的 PC 上运行良好。
google clob 中的 firefox 和 gecko 驱动程序,但发生错误。
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait as wait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
import time
from selenium.webdriver.support import ui
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.common.exceptions import TimeoutException
driver = webdriver.Firefox(executable_path=r'content/geckodriver.exe')
WebDriverException: Message: 'content/geckodriver.exe' executable needs to be in PATH.
我希望 Gecko 驱动程序应该被 Google Colab 环境中的 selenium 识别。
【问题讨论】:
-
您是否检查过您的 selenium 版本和 Firefox 版本之间的同步条件?它们兼容吗?
-
是的。没错。
-
我在我的电脑上试过你的代码,它运行良好。你有什么问题?
-
我知道。正如我在问题中已经说过的,它在我的 PC 上运行正常,但我无法在 GoogleColab 上运行它。
标签: selenium firefox path google-colaboratory geckodriver