-1

I'm suddenly having an issue with clicking a link. This was working previously but now is not and I can't figure out what's wrong.

This is how the link is defined:

 <td id="whiteseparator" class="generalcontent" width="22%">
 <a title="NOT Received" onclick="javascript:gotosubmit('SalaryDetailsList'); return false;" href="#">NOT Received</a>
 </td>

This is my code clicking the link. There are several of these and what I'm trying to do is get all of them so I can then iterate through all of them.

 List<WebElement> mylinks = driver.findElements(By.cssSelector("a[title='NOT Received']"));
 for (int i=0 ; i < mylinks.size() - 1; i++)
      {
      mylinks.get(i).click();  
      ....(and so on)

It's not getting past the List statement. It just sits there. Any ideas?

Chandra Shekhar
  • 664
  • 2
  • 9
  • 24
Sulteric
  • 505
  • 6
  • 16
  • 2
    can you please share the exception too? – Chandra Shekhar Jul 26 '16 at 13:28
  • What do you mean `having an issue with clicking a link`?? is there any execption?? why are going to click all links in the loop while it will throw `StaleElementExcpetion` if first found link navigating to other page by click.. – Saurabh Gaur Jul 26 '16 at 13:41
  • That's the odd thing about it. There is no exception, it just sits there forever and waits! It makes no sense! – Sulteric Jul 26 '16 at 15:19
  • There can be for example five of these links on the page. Each one has to be clicked, taking the user to another page for data entry. Once all five are clicked and data entered further processing takes place. – Sulteric Jul 26 '16 at 15:30

1 Answers1

0

This question is rather unclear, but what I've figured out, the button is not clickable, and you want Selenium to click on it.

This is an intentional design, as Selenium is designed as a Web Automation tool, that means if a user can't click it, Selenium can't either.

You might want to check this out: https://stackoverflow.com/a/21387564/4947486

Community
  • 1
  • 1
Jakub Loksa
  • 537
  • 1
  • 14
  • 32