SeleniumLab

Course1 · Selenium automation → Headless & Next Steps

1 · Selenium automation

Headless Chrome and CI tips

10 min · Module 13

Headless mode is useful in CI. Also set a window size, use unique test data, and keep selectors stable.

Example / notes

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("--headless=new")
options.add_argument("--window-size=1280,800")

driver = webdriver.Chrome(options=options)
driver.get("http://127.0.0.1:8000/lab/")
driver.save_screenshot("lab_hub.png")
driver.quit()

Practice in Lab: /lab/

Log in to track progress / take quizzes
Modules in this track