sudoapt-getupdate&&sudoapt-getinstall-ychromiumpython3-venv
# Link for downloading the ChromeDriver found here: https://googlechromelabs.github.io/chrome-for-testing/#stablecurl-fLO"https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$(chromium--product-version)/linux64/chromedriver-linux64.zip"unzipchromedriver-linux64.zip
python3-mvenvmyvenv
myvenv/bin/python3-mpipinstall'selenium==4.*'myvenv/bin/python3-<< 'EOF'from selenium import webdriverfrom selenium.webdriver.chrome.service import Service as ChromeServiceservice = ChromeService(executable_path='chromedriver-linux64/chromedriver')with webdriver.Chrome(service=service) as driver: driver.get('https://www.example.com/') print(driver.title)EOF
Note: this example aims to be as complete as possible. However, if you don't download the ChromeDriver, Selenium should automatically recognize the browser version and download the correct one into ~/.cache/selenium/chromedriver. See https://www.selenium.dev/documentation/selenium_manager/ for more information.