How can I run Selenium Python tests in Headless mode?

How can I run Selenium Python tests in Headless mode?

Hi Ian!

To perform Selenium automation testing with Python, you need to add the headless capability in your desired capabilities as shown below -

desired_caps = {
            'LT:Options': {
                "build": "Python Demo",  # Change your build name here
                "name": "Python Demo Test",  # Change your test name here
                "platformName": "Windows 11",
                "selenium_version": "4.0.0",
                "headless": True    
            },
            "browserName": "Chrome",
            "browserVersion": "98.0",
        }

You can check out the below GitHub repo for the same -