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.