Skip to content

Selenium

Selenium can connect to rayobrowse via a CDP shim that bridges ChromeDriver to the daemon’s WebSocket endpoints.

Terminal window
pip install rayobrowse selenium webdriver-manager
from rayobrowse import create_browser
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
ws_url = create_browser(headless=False, target_os="windows")
# The full Selenium example with CDP shim is available at:
# https://github.com/rayobyte-data/rayobrowse/blob/main/examples/selenium_example.py

The complete example includes a cdp_shim context manager that:

  1. Starts a minimal local HTTP server
  2. Proxies ChromeDriver’s /json/version and /json/list requests to the daemon
  3. Allows Selenium to connect via options.debugger_address

See the full example on GitHub.