简体   繁体   中英

Selenium WebDriver methods vs. JavaScript executor

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 (eg 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.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM