Selenium Java - wait.until(ExpectedConditions is working at non-headless mode but not at headless mode

Viewed 107

At Selenium with Java I have this line:

wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[contains(text(),'Return to:')]")));

which works fine at non-headless mode, but not working at headless mode. I get the error "Expected condition failed: waiting for visibility of element located by... : Return to:".

I use Selenium 3.141.5 with chromedriver 101.0.4951.41.

What could be the reason? I have also tried to find element by linkText.

0 Answers
Related