Headless Element not visible

my test case is working if I run it with firefox, but with headless it cant click on the element, because it is not visible.


Hi all,

I got same issue with this one.
TestObject was found in both Chrome and Chrome headless but
Click only works in Chrome but not in Chrome headless.

Unable to click on object ‘’ (Root cause: org.openqa.selenium.ElementNotVisibleException: element not visible

Would be very helpful if someone can give any hints.

Thank you.

Hi all,

sorry, I just found out the root cause.

For me, this was because the default windows size of Chrome Headless was 800x600 , and the button was not shown in this resolution.

I’m changing it by adding argument --window-size while running it and everything goes as expected.

Thank you

1 Like

If the resolution is an issue you can use a built in function. I have had some issues before when the window was not maximized. You can simply use WebUI.MaximizeWindow() Hope this will help!

set a “delay” or “wait for element visible”