Can I run OpenTest automation scripts in headless Chrome mode?

I’m trying to figure out if OpenTest can handle automated testing without showing the browser window. I want to run my test scripts in headless mode using Chrome.

I’ve set up my actor configuration file like this but I’m not sure if it’s correct:

selenium:
    desiredCapabilities:
        browserName: chrome
        chromeOptions:
            args: [ --headless ]
    chromeDriverExePath: D:/testing/drivers/chromedriver.exe

When I run the tests, Chrome still opens normally instead of running headless. Am I missing something in the configuration? Does this setup work with the newest Chrome versions or do I need additional parameters?

Any help would be great!

try adding --disable-gpu and --no-sandbox to your chrome args. headless mode needs those flags to function properly. also, make sure your chromedriver version matches the browser. if they don’t match, the headless setting might not work.

Had the same headaches with OpenTest headless setup. OpenTest needs explicit driver options - can’t just throw args in an array and hope it works. Here’s what fixed it for me:

selenium:
    desiredCapabilities:
        browserName: chrome
        goog:chromeOptions:
            args: [ "--headless", "--disable-dev-shm-usage", "--remote-debugging-port=9222" ]
    chromeDriverExePath: D:/testing/drivers/chromedriver.exe

Key thing is using goog:chromeOptions instead of just chromeOptions. Newer Chrome versions follow W3C WebDriver standards and get picky about this. The remote debugging port helps keep headless mode stable too. Also run OpenTest as admin - headless sometimes needs elevated permissions to access system stuff.

Your config’s almost right but there’s a syntax issue. You need to nest chromeOptions under chrome capabilities. Here’s what fixed it for me:

selenium:
    desiredCapabilities:
        browserName: chrome
        chrome:
            chromeOptions:
                args: [ --headless, --window-size=1920,1080 ]
    chromeDriverExePath: D:/testing/drivers/chromedriver.exe

I had the exact same issue - Chrome kept opening visually even with headless enabled. Fixed it by restructuring the YAML and adding window-size. Without dimensions, tests fail because elements can’t be found in headless mode. This setup’s worked solid for me on Chrome 90+.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.