I spent some time trying to make selenium work with pyscript. I run Home Assistant in docker. My solution was to run chrome as a container:
docker run -d -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-chrome:latest
My requirements.txt is:
selenium
and this is how I connect to a website:
from selenium import webdriver
driver = webdriver.Remote("http://localhost:4444/wd/hub", options=webdriver.ChromeOptions())
driver.set_window_size(1280, 1024)
driver.get('https://.../')
...
driver.close()