Clicking on hidden element in Selenium WebDriver

0 votes

I have a grid which displays some records. When I click on a record and inspect that element it is shown that it is hidden but it is visible in the grid.

My HTML code is:

<a href="http://192.168.1.6/eprint_prod_3.8/settings/othercost_add.aspx?type=edit&id=805" title="Plastic Spiral Bind"
<div style="float: left; width: 99%; overflow: hidden; height: 15px; overflow: hidden"> Plastic Spiral Bind </div>
</a>

Selenium code for the same:

driver.findElement(By.partialLinkText("Plastic Spiral Bind")).click();
Jun 12, 2018 in Selenium by darklord
• 6,140 points
3,598 views

1 answer to this question.

0 votes

let us first store that element in the object, and then use the below code to click on that hidden element:

JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("arguments[0].click();", element);
answered Jun 12, 2018 by Meci Matt
• 9,420 points

Related Questions In Selenium

0 votes
2 answers

Unable to Click on an Element in Selenium (Python) even after finding it.

Here, I give you working script which ...READ MORE

answered Sep 19, 2018 in Selenium by Priyaj
• 56,520 points
7,359 views
0 votes
1 answer

Need some advise on the preferred element locators with Selenium WebDriver

Well let's not call it "Hierarchy". But, ...READ MORE

answered Apr 13, 2018 in Selenium by king_kenny
• 3,650 points
91 views
+4 votes
3 answers

Verifying whether an element present or visible in selenium Webdriver

Below code will help you: To check Element ...READ MORE

answered Apr 17, 2018 in Selenium by king_kenny
• 3,650 points
13,665 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,090 points
557 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,130 points
891 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,130 points
557 views
0 votes
1 answer
0 votes
1 answer

Check that the element is clickable or not in Selenium WebDriver

Use Selenium Waits: WebDriverWait ...READ MORE

answered Jun 12, 2018 in Selenium by Meci Matt
• 9,420 points
8,512 views