I'm developing an application for automation of an upload process on a website. Right now it is working with Gecko Driver on Firefox but I want to change to HtmlUnitDriver. For this application I just started using Selenium. At the begin I just used methods on WebElements (e.g. click() ...). Then there was a difficult part where it doesn't worked out. After that I found the JavascpriptExecutor class. This class was the solution of my Problem. Now I am thinking about totally change from WebDriver Methods to JavaScriptExecutor. I think it will be faster and less error-prone. Am I right? Are there any disadvantages for me to change to JavascriptExecutor? Thanks in advance.
Asked
Active
Viewed 609 times
1 Answers
1
For QA testing generally one should not use JavascriptExecutor.
Read more about Why using JavascriptExecutor in WebDriver can be dangerous.
But for getting stuff done and fast It is great!
Read more about What are the advantages of using a JavaScript executor in Selenium.
Hope this helps you!

Moshe Slavin
- 5,127
- 5
- 23
- 38