20301

Limitation of HTMLUnit driver for headless testing

Question:

Can I perform following functions using HTML Unit Driver headless browser automation?

<ol><li>Is it possible to take snapshot?</li> <li>Can click any hyperlink ?</li> <li>Possible to handle pop-ups?</li> </ol>

Please help

I am planning to do automation using HTMLUnit driver

Answer1:

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 :)

Recommend

  • Changing Xpath on the same URL makes Assert in Login Test to fail
  • Radio input in header of accordion problem ?BUG
  • Grails select not returning the object but a string
  • Grails - functional test with Geb doesnt work with HtmlUnitDriver
  • SQL: group by from other table and invert result
  • Play Framework csrf token generation in unit test
  • ChromeDriver disable rendering and CSS
  • How can I change the date in .bat batch files
  • PhantomJS set browser timezone setting
  • Window object in PhantomJS
  • how to screenshot a div using phantomJS
  • Sending and Receiving SMS [closed]
  • Can I commit a file with git, but automatically ignore it when doing a git svn dcommit?
  • How to pause a python script running in terminal
  • Help with one step build all projects + installer (.NET + WiX)
  • iPhone - UIWebView multiple locks
  • How to get to older Xcode beta version?
  • Safari PHP form submission -file upload hangs
  • Spark (Scala) Writing (and reading) to local file system from driver
  • Python cosine function precision [duplicate]
  • XSLT foreach repeating nodes to flat
  • vectorized indexing/slicing in numpy/scipy?
  • Rest Services conventions
  • pip in virtualenv gets ConnectTimeoutError
  • How to access culture data in globalize.js V1.0.0
  • pyodbc doesn't report sql server error
  • Spring Cloud Microservice Architecture Confusion
  • Zurb Foundation _global.scss meta styles for js?
  • Date Conversion from yyyy-mm-dd to dd-mm-yyyy
  • print() is showing quotation marks in results
  • How can I send an e-mail from a vbs script
  • Android screen density dpi vs ppi
  • RectangularRangeIndicator format like triangular using dojo
  • How would I use PHP exceptions to define a redirect?
  • How to extract text from Word files using C#?
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • Convert array of 8 bytes to signed long in C++
  • Is there a mandatory requirement to switch app.yaml?
  • need help with bizarre java.net.HttpURLConnection behavior
  • UserPrincipal.Current returns apppool on IIS