How can we use JavaScript Executor to click and enter data to a web element in Selenium?

0 votes
How can we use JavaScript Executor to click and enter data to a web element in Selenium?
Jul 8, 2019 in Selenium by Uday
775 views

1 answer to this question.

+1 vote
WebElement element = driver.findElement(By.id("abcd")); // Let the element id be abcd
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
answered Mar 21 by Lakshmi Sarvepalli

Related Questions In Selenium

0 votes
1 answer
0 votes
2 answers

How to use JavaScript in selenium to click an Element?

JavascriptExecutor js = (JavascriptExecutor) driver;   js.execute ...READ MORE

answered Apr 1 in Selenium by anonymous
27,986 views
0 votes
1 answer
0 votes
1 answer

How can I perform mouse hover to a web element with ruby and selenium webdriver?

Hi Siddhart, checkout the following script to ...READ MORE

answered Aug 26, 2019 in Selenium by Abha
• 27,930 points
548 views
0 votes
1 answer

How to use link as a locator to find element in selenium?

Hello @Jino, its amazing to explore ways ...READ MORE

answered Dec 21, 2018 in Selenium by Nabarupa
237 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,510 points
3,164 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,890 points
2,376 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,890 points
2,527 views