4

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!

Adrian Theodorescu
  • 11,664
  • 2
  • 23
  • 30

1 Answers1

3

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.

Adrian Theodorescu
  • 11,664
  • 2
  • 23
  • 30