How to execute JavaScript in Selenium?

Published: 12 March 2019
on channel: CosmoCode
2,171
18

In this video we'll learn how to use mighty JavascriptExecutor to execute JavaScripts in Selenium WebDriver.

In real life projects, it happens that sometimes the WebDriver is not able to perform the action on a particular element. There can be several reasons for that. One of the reason is that since WebDriver simulates end-user interaction, it is natural that it will refuse to click on an element that is not visible to end user. Sometimes it happens that although the element is visible on the page, still WebDriver thinks it is not visible.

In these cases, we write a piece of JavaScript to click or perform other actions on that element and make it execute through WebDriver.

Previous Videos Links:

1. How to setup system for Selenium -    • 1. How to setup system for Selenium  

2. Writing the first Selenium script -    • 2. Hello Selenium! Writing the first ...  

3. How to locate elements in the page (by using its id, class or name attribute) -    • 3. How to find id, class or name attr...  

4. How to use XPath to locate elements in the webpage -    • 4. How to write XPath to find element...  

5. How to use CSS Selector to locate elements in the webpage -    • 5. How to use CSS Selector to find el...  

6. How to use WebDriver Locators and interact with the UI elements?
   • 6. How to automate any webpage by usi...  

7. Tricks to find UI elements like an expert in Selenium
   • 7. Tricks to find UI elements like an...  

8. Implicit & Explicit Wait | Write robust Selenium script that does not break with load time issues
   • 8. Implicit & Explicit Wait | Write r...  

9. How to handle Alert box in Selenium? Click OK, Cancel or get the text.
   • 9. How to handle Alert box in Seleniu...  

10. How to handle Popup Windows in Selenium? Switch by using window handle or page title
   • 10. How to handle Popup Windows in Se...  


Watch video How to execute JavaScript in Selenium? online without registration, duration hours minute second in high quality. This video was added by user CosmoCode 12 March 2019, don't forget to share it with your friends and acquaintances, it has been viewed on our site 2,171 once and liked it 18 people.