问题
Can I perform following functions using HTML Unit Driver headless browser automation?
- Is it possible to take snapshot?
- Can click any hyperlink ?
- Possible to handle pop-ups?
Please help
I am planning to do automation using HTMLUnit driver
回答1:
Yes, You can perform all operations as per of your all 3 point using headless browser. Don't use HTMLUnit
as it have many configuration issue.
PhamtomJS was another approach for headless browser but PhantomJs is having bug these days because of poorly maintenance of it.
You can use chromedriver itself for headless jobs.
You just need to pass one option in chromedriver as below:-
chromeOptions.addArguments("--headless");
Full code will appear like this :-
System.setProperty("webdriver.chrome.driver","D:\\Workspace\\JmeterWebdriverProject\\src\\lib\\chromedriver.exe");
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
chromeOptions.addArguments("--start-maximized");
WebDriver driver = new ChromeDriver(chromeOptions);
driver.get("https://www.google.co.in/");
Hope it will help you :)
来源:https://stackoverflow.com/questions/45790062/limitation-of-htmlunit-driver-for-headless-testing