I am using headless chrome for our selenium tests and did the below changes:
DesiredCapabilities desiredCapabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
options.addArguments("--disable-gpu");
options.addArguments("window-size=1800x1080");
desiredCapabilities.setCapability(ChromeOptions.CAPABILITY, options);
It logs into an internal page and then waits for the element to be visible:
selenium.waitForElementVisible("xpath=//tr/td/div[@class[contains(., 'x-grid-cell-inner')] and text()='Global Test Merchant 14']");
This all works well when I do not have the headless option:
This is what I get aan error:
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//tr/td/div[@class[contains(., 'x-grid-cell-inner')] and text()='Global Test Merchant 14']"}
when I run the test with --headless.
Chrome Version: 62.0.3202.89 chromeDriver: 2.33.506120 Selenium version: 2.53.0 Windows 7