I’m attempting to set up Selenium with Java and utilize the Chrome Headless mode for my project. However, I’m encountering an “element not interactable” error. Despite experimenting with various window size configurations, I haven’t found a solution. Interestingly, the same script runs flawlessly in an interactive Chrome session. Moreover, when I test it on a different website with the same headless settings, it works perfectly. Am I overlooking something? Here’s the code I’ve used for configuring ChromeOptions, along with the error details.
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--width=1920");
chromeOptions.addArguments("--height=1080");
chromeOptions.addArguments("--disable-gpu");
chromeOptions.addArguments("--no-sandbox");
chromeOptions.addArguments("--headless");
driver = new ChromeDriver(chromeOptions);
Error Logs:
org.openqa.selenium.ElementNotInteractableException: element not interactable
(Session info: headless chrome=85.0.4183.121)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'OM', ip: '172.XX.XX.XX', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver