Skip to content

TestingWithSK/selenium-javascript-executor-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Selenium – JavaScriptExecutor

Java Selenium

Read the complete Blog - How to use JavaScriptExecutor in Selenium

In this article, you will learn about how JavaScriptExecutor works in selenium. Basically, JavaScriptExecutor is an Interface that allows you to execute JavaScript through the Selenium web driver. It is a medium that allows a web driver to interact with the HTML elements of a webpage. It provides two methods i.e. executeScript and executeAsyncScript, to execute JavaScript on a selected webPage.

JavaScriptExecutor Methods

  • ExecuteAsyncScript
  • ExecuteScript

ExecuteAsyncScript

This method executes an asynchronous piece of JavaScript on the current webpage. With the asynchronous script, web pages render very quickly, Instead of waiting for the script to download before the page renders which enhances the application performance.

ExecuteScript

This method executes JavaScript in the context of the currently selected webpage or window. The script in this method runs in the body of an anonymous function. This script can return WebElement, long, Boolean, list, or String.

Clone the repository using -

git clone https://github.com/TestingWithSK/selenium-javascript-executor-example.git

Run the Test Case -

  • Right click on any java file inside src/test/java/example and select - Run '<FILE_NAME>'

Read the complete Blog - How to use JavaScriptExecutor in Selenium

Happy Testing!!!


Read More Articles

Testing Blog

Follow us on Social Media Accounts

LinkedIn Instagram Facebook

About

Selenium javaScriptExecutor examples with java.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages