Issue: headless chrome seems to take an endless amount of time to load a login page, and so it always times out and fails to find elements.
This does not happen in headless Firefox, or Chrome/Firefox in normal mode.
What I’ve tried so far:
Added a WebUI.delay(500) for example to see if it actually gets the page loaded (this still fails). The waitForElement type methods also fail, along with the verifyElement ones too.
Screenshots taken at the failed test, show a half loaded page mostly.
So it seems like there’s some sort of problem with my headless chrome loading these dynamic pages generated by NextJS.
I’ve tried adding all sorts of Desired Capabilities and none of them made a difference.
I know this has to be something to do with headless chrome, but I’m not entirely sure what. So I’m hoping that someone here has had some experience with this and knows the answer to my problem. As I’ve literally been fighting this for months. It worked fine at one point. Then stopped after a Chrome update (and yes, i do keep my web drivers up to date with the browser updates. Every week I make sure to update both browser and katalon drivers for firefox and chrome.
In order to understand your concern, we would need to reproduce this issue on our side and investigate it hands-on. Please provide us enough information how to reproduce the issue on our side.
share the Next.js-based webapp project zipped. You can assume that we have node and npm installed on our side and we can do npm install to recreate the project, npm run dev to launche the React app.
i’m just curious how the execution on the katalon testops using that Chrome-headless issue profile. can you try to run your test on the katalon testops?
Thanks, dineshh. I’ll give some of these flags a try and see if anything helps here. If it does, I’ll make sure to update this thread with the info so others can benefit from it too.
It appears that something with using the ChromeOptions rather than desired capabilities seems to be working. So now i’ll troubleshoot what was causing my issue there.
These are the ones I used:
ChromeOptions options = new ChromeOptions()
options.addArguments("headless")
options.addArguments("window-size=1920,1080")
options.addArguments("disable-gpu")
options.addArguments("no-sandbox")
options.addArguments("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36")
WebDriver driver = new ChromeDriver(options)
DriverFactory.changeWebDriver(driver)
If i can’t get these working in Desired Capabilities properly, then I’ll just set something up in my listener setup to only set these options when the browser is set to Chrome Headless.
Hopefully that is the end of my woes with headless chrome
Thanks for those that gave some input. I appreciate it.