简体   繁体   中英

Why we need javaScript executor for webdriver?

Can one please help me to know why we exactly need JavaScriptExecutor for Webdriver?

I have seen few examples using JavascriptExecutor to mouse hover, to click on any elements which can also be done normally with Webdriver.

And there are cases which i have seen is when the element is disabled, using JavascriptExecutor clicking on that element. Why we need to perform any operations on disabled elements (to user on FrontEnd).

It is actually a nice question.

Selenium is basically solve simple java script event problem.

But when we need to test application at Industry level, We require to write JQuery as well as Java script.

For EG In some website there is some restriction like double click or right click or selection.

In this cases we have to write java script with "JavascriptExecutor".

As per my understanding you want to ask why "JavascriptExecutor" is perform event on disable element?

In answer , I want to say it is may be a test case requirement.

You may be think why we need to write javascript for selenium in built method?

So selenium provide both way that you are prefer.But With "Action" we have to call inbuilt Java functions which are integrate with mouse. And With "JavascriptExecutor" we have our implementation with modified code.

This is main Advantage over inbuilt functions.

:)

If you have any query comment me.
Thank 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