Does OpenTest support automated tests on a headless browser?

360 views Asked by At

Is it possible to execute OpenTest scripts on a headless instance?

My actor file configuration is done as below, but the browser is called as default. Should that be enough to run the latest Chrome version on headless mode?

...
selenium:
    # seleniumServerUrl: http://127.0.0.1:9515
    desiredCapabilities:
        browserName: chrome
        chromeOptions:
            args: [ --headless ]
    chromeDriverExePath: C:/opentest/drivers/chromedriver.exe
...

Thanks!

1

There are 1 answers

0
Adrian Theodorescu On

OpenTest supports sending command line arguments to the Selenium driver(s) using parameters like chromeDriverExeArgs, firefoxDriverExeArgs, etc. Here's how you can set the headless argument in the actor.yaml file and configure the browser window size:

...
selenium:
    desiredCapabilities:
        browserName: chrome
    chromeDriverExePath: C:/opentest/drivers/chromedriver.exe
    chromeDriverExeArgs: [ headless ]
    resolution: 1920x1080
...

Resolution can also be changed dynamically from the test by using the SetBrowserAspect keyword.