What is JavaScriptExecutor and how it helps in Selenium automation

0 votes
Jun 4, 2019 in Selenium by Rohan
3,213 views

1 answer to this question.

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, 2019 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 29, 2019 in Selenium by Anvi
• 14,150 points
1,817 views
0 votes
1 answer

What is IWebElement and how it is used in Selenium C#?

Hello Paul, IWebElement is an Interface in ...READ MORE

answered Jun 11, 2019 in Selenium by Esha
11,842 views
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, 2019 in Selenium by Abha
• 28,140 points
3,027 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 9, 2019 in Selenium by Pratibha
• 3,690 points
5,372 views
0 votes
2 answers

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,500 points
13,674 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,143 views
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,910 points
7,221 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,875 views
0 votes
1 answer

What is Base class in Selenium and how it works?

Hey Prashant, in Selenium Base class is the main ...READ MORE

answered Jul 18, 2019 in Selenium by Abha
• 28,140 points
20,834 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
1,303 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP