Why does button only become disabled in HEADLESS mode?

Does anyone know why this might be happening in HEADLESSCHROME only.

As you can see RF script can find the button and it thinks its in an ENABLED state but when it comes to CLICK ELEMENT its become disabled. If I run this in non-headless mode it runs fine.

I’ve changed to use the @CLASS instead of XPATH makes no difference.

I wonder if this is an Angular 8 Framework issue?

Attached is the screenshot differences of the same buttons state.

I have tried various means to allow RF to detect this button like WAIT UNTIL ELEMENT IS ENABLED etc I don’t really want to revert to non headless.

rf_but_enabled

Env.

Chrome latest
Selenium 5
Win 2019 Server

Any site can implement “headless” or “automation” detection and refuse to work if given criteria is met. This could be one of those ?

Hi, No I don’t think its this. Thank you.

Another reason might be the window size, did you set the window size or maximise it after launching it headless?

I’ll note that the error you are receiving is “ElementClickInterceptedException” and not something like “InvalidElementStateException” which one might expect due to an element being disabled. It is also telling which element is intercepting the click.

This is a good lesson in automation. My tests were working correctly and they discovered failed the button being disabled was because of the browser versions. Although EDGE and Chrome are built on Chromium for some reason a slightly older versions of Chrome the button was being rendered as disabled by default. The same test in latest EDGE worked perfectly. Thanks all for your input.

2 Likes