您可以通过安装Chrome Web驱动程序并调整一些选项来做到这一点,以使其在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/binimport syssys.path.insert(0,'/usr/lib/chromium-browser/chromedriver')from selenium import webdriverchrome_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")


