NoSuchElementException with headless chrome and selenium

好久不见. 提交于 2019-12-03 17:23:30

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

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')]
Bobby Mor

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");
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!