!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")
Here is what the above code is Doing:
1. Install Selenium and ublock origin.
2. Install Chrome.
3. Install chromedriver.
4. Set the path of chromedriver.
5. Set options for the webdriver.
6. Run the webdriver and load the page.