How to run browser in headless mode in UnitTest on LambdaTest?

Please help with how I can run browser in headless mode in UnitTest?

Hi Ana,

In order to help you run a browser in headless mode in UnitTest Test Automation on LambdaTest, here’s a sample repo:

You can run a test in headless mode by providing it as a capability in test file. The capabilities would look something like this:

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 refer to the sample GitHub repo for the same: