我正在尝试在Chrome for the google colab的selenium模块(python)中运行webdriver资源。首先,我在解析命令(selenium.webdriver.Chrome('/chromedriver.exe')),中的chromedriver.exe文件时遇到了问题,克服了我发现运行chromedriver.exe的权限为none的连续失败,并且版本是ok的,谁知道可能出了什么问题?
WebDriverException:消息:'chromedriver.exe‘可执行文件可能具有错误的权限。
发布于 2020-04-09 06:14:37
您可以通过安装chromium并调整一些选项,使其不会在google colab中崩溃:
!pip install selenium
!apt-get update # to update ubuntu to correctly run apt install
!apt install chromium-chromedriver
!cp /usr/lib/chromium-browser/chromedriver /usr/bin
import sys
sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver')
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
wd = webdriver.Chrome('chromedriver',chrome_options=chrome_options)
wd.get("https://www.webite-url.com")https://stackoverflow.com/questions/61110812
复制相似问题