What is JavaScriptExecutor and how it helps in Selenium automation?

0 votes
Jun 4 in Selenium by Rohan
20 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

@Rohan, JavaScript executor is an interface of Selenium WebDriver that has the functionality similar to that of Java Script and can interact with HTML DOM elements. Instead of using driver.findElement method of the Selenium WebDriver we can use JavaScriptExecutor Interface to perform similar action on the Page. It provides advantages over FindElement method while handling tricky XPath as well as finding element which are sometimes hidden.

Not only that, we can perform several other Java Script actions such as Browser Object Model (BOM), AJAX in addition to HTML DOM actions with the help of JavaScript Executor. Some scenarios we could handle using JavaScript Executor are:

  1. To type Text in Selenium WebDriver without using sendKeys() method

  2. To click a Button in Selenium WebDriver using JavaScript

  3. To handle Checkbox

  4. To generate Alert Pop window in selenium

  5. To refresh browser window using Javascript

  6. To get innertext of the entire webpage in Selenium

  7. To get the Title of our webpage

  8. To get the domain

  9. To get the URL of a webpage

  10. To perform Scroll on an application using  Selenium

  11. To click on a SubMenu which is only visible on mouse hover on Menu

  12. To navigate to different page using Javascript

answered Jun 4 by Pratibha

Related Questions In Selenium

0 votes
1 answer

What is Firebug and how it is useful in Selenium Automation testing?

Hello Amit, FireBug is a plugin which comes ...READ MORE

answered May 28 in Selenium by Anvi
• 7,160 points
28 views
0 votes
1 answer
0 votes
1 answer

What is Apache POI in Selenium and what it is used for?

Hi Raj, Apache POI is the most commonly ...READ MORE

answered May 8 in Selenium by Abha
• 8,250 points
48 views
0 votes
1 answer

What is Xpath and what are the types of it in Selenium Webdriver?

Hi Piyush, XPath is defined as XML path. It is ...READ MORE

answered May 8 in Selenium by Pratibha
• 2,520 points
31 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,050 points
135 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
527 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
129 views
0 votes
1 answer

What is TestNG and why it is used in selenium?

Hello @User, Talking about TestNG, it is an ...READ MORE

answered Dec 24, 2018 in Selenium by Shuvodip
53 views
0 votes
1 answer

What is the difference between getWindowHandle() and getWindowHandles() methods in Selenium WebDriver?

Hey Jennifer, difference between getWindowHandle() and getWindowHandles() ...READ MORE

answered Jun 3 in Selenium by Anvi
• 7,160 points
33 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.