Use selenium in Colab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install chromium, its driver, and selenium | |
!apt install chromium-chromedriver | |
!cp /usr/lib/chromium-browser/chromedriver /usr/bin | |
!pip install selenium | |
# set options to be headless, .. | |
from selenium import webdriver | |
options = webdriver.ChromeOptions() | |
options.add_argument('--headless') | |
options.add_argument('--no-sandbox') | |
options.add_argument('--disable-dev-shm-usage') | |
# open it, go to a website, and get results | |
wd = webdriver.Chrome('chromedriver',options=options) | |
wd.get("https://www.website.com") | |
print(wd.page_source) # results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment