I have one 2 min script for Selenium webdriver. It works very fine with FirefoxDriver and ChromeDriver. It never gets fails with real browser.
But when I run with HTMLUnit driver I have found Its fails randomly. Throws exception like not able to find element.
Solutions that I have tried out :
- Add Thread.sleep to 6000 ms. But still not run every-time
- Add wait but it throws error at same line
- Change locator of element from Id to xpath or CSS path.
Configuration and Versions:
selenium-java : 2.53.0
selenium-server : 2.53.0
htmlunit-driver : 2.21
TestNG : 6.8.8