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
1,592 views

2 answers 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, 2020 by Lakshmi Sarvepalli
0 votes
 document.getElementById("controlid").value = "urtext";
answered Aug 31, 2020 by Sri
• 3,010 points

Related Questions In Selenium

0 votes
5 answers

How to use JavaScript in selenium to click an Element?

WebElement element = driver.findElement(By.id("id")); JavascriptExe ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,010 points
40,490 views
0 votes
2 answers
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
• 28,020 points
993 views
0 votes
2 answers

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

driver.findElement(By.linkText("link")).click(); READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,010 points
412 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,520 points
4,904 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,010 points
5,702 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,890 points
3,479 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 2, 2020 in Selenium by Sri
• 3,010 points
4,179 views