# Why does button only become disabled in HEADLESS mode?

**URL:** <https://forum.robotframework.org/t/why-does-button-only-become-disabled-in-headless-mode/4228>\
**Category:** SeleniumLibrary\
**Created:** [19 July 2022 10:58 UTC](https://forum.robotframework.org/t/why-does-button-only-become-disabled-in-headless-mode/4228 "2022-07-19T10:58:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![resourceful-idiot](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@resourceful-idiot](https://forum.robotframework.org/u/resourceful-idiot)\
**Post date:** [19 July 2022 10:58 UTC](https://forum.robotframework.org/t/why-does-button-only-become-disabled-in-headless-mode/4228/1 "2022-07-19T10:58:24Z")

</div>

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.

 ![rf_but_head_enabled](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/c/c264ab517a3b9b0392d177860888267e68c4dcf6.png)

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](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/0/01cc176aeb2090ebc061f2851e2d9fc2dca607b3.png)

Env.

Chrome latest  
Selenium 5  
Win 2019 Server

---

<div class="post-metadata">

**Author:** ![rasjani](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@rasjani](https://forum.robotframework.org/u/rasjani)\
**Post date:** [19 July 2022 11:14 UTC](https://forum.robotframework.org/t/why-does-button-only-become-disabled-in-headless-mode/4228/2 "2022-07-19T11:14:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![resourceful-idiot](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@resourceful-idiot](https://forum.robotframework.org/u/resourceful-idiot)\
**Post date:** [19 July 2022 13:36 UTC](https://forum.robotframework.org/t/why-does-button-only-become-disabled-in-headless-mode/4228/3 "2022-07-19T13:36:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [21 July 2022 04:43 UTC](https://forum.robotframework.org/t/why-does-button-only-become-disabled-in-headless-mode/4228/4 "2022-07-21T04:43:14Z")

</div>

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

- [Set Window Size](https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Set%20Window%20Size)
- [Maximize Browser Window](https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Maximize%20Browser%20Window)

---

<div class="post-metadata">

**Author:** ![EdManlove](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/edmanlove/32/1002_2.png) [@EdManlove](https://forum.robotframework.org/u/EdManlove)\
**Post date:** [23 July 2022 16:12 UTC](https://forum.robotframework.org/t/why-does-button-only-become-disabled-in-headless-mode/4228/5 "2022-07-23T16:12:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![resourceful-idiot](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@resourceful-idiot](https://forum.robotframework.org/u/resourceful-idiot)\
**Post date:** [28 July 2022 15:30 UTC](https://forum.robotframework.org/t/why-does-button-only-become-disabled-in-headless-mode/4228/6 "2022-07-28T15:30:52Z")

</div>

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.
