MarkMck
MarkMck

Reputation: 11

Test Framework Has Stopped Working In Headless Mode (On Mac)

I have an automation framework written using selenium, maven and java to test my company portal.

In the last week or so Im having a major issue with headless execution. My tests do not pass on any OS (Mac, Linux and Windows) when executing in headless. When I execute in non-headless all the tests pass. The second I put it into headless it breaks which I find weird.

The issue mainly seems to be around dropdowns and data not loading or being visible despite putting in waits and waitForElementVisible lines.

java.lang.AssertionError: Element not clickable or not visible org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <md-option value="LOW" tabindex="0" role="option" id="select_option_84">...</md-option> is not clickable at point (458, 380). Other element would receive the click: <md-backdrop class="md-select-backdrop md-click-catcher ng-scope"></md-backdrop>

My chrome options configuration is:

ChromeOptions options = new ChromeOptions();
            options.setExperimentalOption("prefs", chromePrefs);
            options.addArguments("--start-maximized");
            options.addArguments("download.default_directory=" + downloadDirPath);
            options.addArguments("--test-type");
            options.addArguments("--ignore-certificate-errors");
            options.addArguments("--disable-extensions");
            options.addArguments("--disable-infobars");
            options.addArguments("--remote-allow-origins=*");
            options.addArguments("--disable-popup-blocking");
            options.addArguments("--enable-WebGL");
            options.addArguments("--ignore-gpu-blocklist");
            options.addArguments("--ignore-gpu-blacklist");
            options.addArguments("--headless=new");
            options.addArguments("--no-sandbox");
            options.addArguments("--disable-features=EnableEphemeralApps"); // Added argument
            options.addArguments("--disable-dev-shm-usage");
            options.addArguments("--disable-software-rasterizer");
            options.addArguments("--use-webgl=desktop");
            options.addArguments("--disable-search-engine-choice-screen");
            options.addArguments("--window-size=1920,1080");
            options.addArguments("--allow-running-insecure-content");
            options.addArguments("--disable-renderer-accessibility");
            driver = new ChromeDriver(options);
            driver.get(url);

Im using chromeversion 133.0.6943.127 and latest selenium version from maven (4.28.1)

Iv tried all of ChatGPTs fixes and still cannot get it working so looking for anyone who has experienced something like this before.

My tests run overnight on headless execution on a jenkins linux server so its essential I get this fixed as Iv currently had to stop them.

Thanks in advance.

UPDATE: After further investigation it looks like the headless issue is only occurring on Mac OS. I can see the expected System.out.prints on my jenkins Log for Linux and Windows intellij in headless. The tests fail on Mac OS Headless only but pass in headfull mode

Upvotes: 1

Views: 66

Answers (0)

Related Questions