I had a little trouble using Selenium on my Chromebook at first, There wasn't much about the procedure, so I tried to summarize it.
★ If you do it from crostini, you have to install google-chrome on debian side as well. ★ The chrome driver is installed in ‘/ usr / local / chromedriver /’.
$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
$ sudo apt install ./google-chrome-stable_current_amd64.deb
$ google-chrome -version
Insert the one that corresponds to the version you confirmed earlier. https://chromedriver.chromium.org/downloads For the time being, plunge the downloaded one into a Linux file. (It may have been possible to enter it with a command and specify the path.)
$ sudo mkdir /usr/local/chromedriver
$ sudo mv chromedriver /usr/local/chromedriver
$ sudo chmod ugo+x /usr/local/chromedriver/chromedriver
$ pip install selenium
from selenium import webdriver
driver = webdriver.Chrome('/usr/local/chromedriver/chromedriver')
driver.get(url)
html = driver.page_source.encode('utf-8')
driver.quit()
Recommended Posts