NoSuchElementException with headless chrome and selenium NoSuchElementException with headless chrome and selenium selenium selenium

NoSuchElementException with headless chrome and selenium


I had the same issue, my mistake was because i was making driver.get("localhost:...") instead of driver.get("http://localhost:...")


I had a similar issue when I ran headless as well, my project while running headless continue to trigger the NoSuchElementException and the default-browser-check was getting in the way, try adding these arguments. Just a thought

chromeOptions.addArguments("--headless");chromeOptions.addArguments("--test-type");chromeOptions.addArguments("--disable-gpu");chromeOptions.addArguments("--no-first-run");chromeOptions.addArguments("--no-default-browser-check");chromeOptions.addArguments("--ignore-certificate-errors");chromeOptions.addArguments("--start-maximized");


As you are seeing NoSuchElementException you can consider using the xpath along with a waiter for the element to be visible as follows :

//tr/td/div[@class='x-grid-cell-inner' and contains(., 'Global Test Merchant')]