我过去一年都在谷歌笔记本上使用Selenium Chromedriver,它似乎完美地运行着。
但是上周,这个脚本似乎不再工作了。我查看了谷歌笔记本的Python版本,现在是Python 3.8.16,我认为这是代码出错的罪魁祸首。
我使用的代码是:
但是上周,这个脚本似乎不再工作了。我查看了谷歌笔记本的Python版本,现在是Python 3.8.16,我认为这是代码出错的罪魁祸首。
我使用的代码是:
!pip install selenium
!apt-get update # to update ubuntu to correctly run apt install
!apt install -y chromium-chromedriver
!cp /usr/lib/chromium-browser/chromedriver /usr/bin
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')
driver= webdriver.Chrome('chromedriver',options=chrome_options)`
现在在这一行中:
driver= webdriver.Chrome('chromedriver',options=chrome_options)
我收到一个错误,说:
WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 1
有人已经找到了解决方法吗?