Welcome to the wild side of test automation. No fluff, no filler – let’s start where the browser starts: WebDriver options.
You don’t just launch a browser. You tell it how to launch.
options = webdriver.ChromeOptions()
options.add_argument('--headless')
driver = webdriver.Chrome(options=options)
Think of this as coffee for your browser – wake it up the way you want.
Key Options – When and Why?
--headless
: Run without GUI. Fast, CI-friendly, and quiet.--disable-gpu
: Skip GPU acceleration – avoid weird rendering bugs.--window-size=1920,1080
: Control screen size. Critical for responsive UI tests.--no-sandbox
: Required in some containerized environments. Use responsibly.--disable-dev-shm-usage
: Prevent crashes in environments with limited shared memory.--ignore-certificate-errors
: When staging has expired SSLs. Use with caution.--disable-extensions
: Clean browser, no funny business.
Do you need all of them?
Nope. Use what makes sense for your test environment. Too many flags = configuration soup.
TL;DR
--headless
: Default for CI.--window-size
: Essential for layout validation.--no-sandbox
,--disable-dev-shm-usage
: Required for Docker-based test runners.
Next stop: Pytest fixtures – how to stop repeating your setup like a broken record.
See you in part two. 🧪