How to run selenium on a Raspberry Pi?

By | July 20, 2024

Run this code here:

$ nano selenium_demo_headless.py 
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
service = Service('/usr/bin/chromedriver')
chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_argument("headless")

driver = webdriver.Chrome(service=service, options=chromeOptions)
driver.get('https://forums.raspberrypi.com')
print(driver.title)
driver.quit()

Inspired by: https://forums.raspberrypi.com/viewtopic.php?t=359017

Leave a Reply

Your email address will not be published. Required fields are marked *