Elmasekar / UnitTest-headless

A sample repo to help you run a browser in headless mode in UnitTest on LambdaTest. Run your python automation test scripts on Lambdatest.

Home Page:https://www.lambdatest.com/selenium-automation/?utm_source=github&utm_medium=about&utm_campaign=unittest_headless

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to run browser in headless mode in UnitTest on LambdaTest

If you want to run a browser in headless mode for an automation test in UnitTest on Lambdatest, you can use the following steps. You can refer to sample test repo here.

Steps:

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",
        }

Run your test

python lambdatest.py

Links:

LambdaTest Community