TT_
TT_

Reputation: 385

ElementNotVisibleException when running headless browser on Jenkins node. Test case runs successfully on local machine using chrome broswer

I am running Selenium headless browser on a Jenkins windows node as a part of test suite. However, it throws org.openqa.selenium.ElementNotVisibleException - element is not visible.

On my local machine, I am able to run the same test suite successfully. The only difference is that I use chrome browser instead of a headless browser.

Can someone help me with this one?

Note:

  1. I have verified that the element is visible on the page.
  2. I have tried adding wait/sleep before the page is rendered. But, it still throws exception when running on Jenkins.

Upvotes: 4

Views: 821

Answers (1)

Vincent Free
Vincent Free

Reputation: 26

I had the same problem. With me it was the headless screen size. Our Jenkins maintainer group in the company set the default screen size to 640:480 so my page didn't render the way it should. I use Xvfb for setting the screen in Jenkins, using this extra cmd/shell command:

export DISPLAY=:1 Xvfb :1 -screen 0 1920x1080x16 &

I hope this helps :)

Upvotes: 1

Related Questions