Locate particular link text among multiple match results while locating web elements in Selenium Webdriver?

0 votes
How can I location a particular link text among multiple match results while location web elements in Selenium Webdriver?
Jun 20 in Selenium by Yash
67 views

1 answer to this question.

0 votes

Hey Yash, if you want to locate a particular link text among multiple match results, you can use List<WebElements> to get all the matching results and then iterate through them using foreach. You can also specify the index to get desired element from specific location. Although providing the relative xpath or any other unique locator should be an ideal approach, but to resolve your issue, you can do something like this:

driver.findElement(By.xpath("(//*[@class='weblinks'])[2]");
answered Jun 20 by Pratibha

Related Questions In Selenium

0 votes
1 answer

How to locate web elements in Selenium-Python?

@Urvashi in Python, Selenium Webdriver API supports ...READ MORE

answered May 27 in Selenium by Anvi
• 12,840 points
54 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

XPath for the elements with no ID or Name in Selenium Webdriver

Use like this or similar to this: //div[@id="top-level-menu-item-3"]/div[@class="filter-label"] //div[@id="top-level-menu1"] ...READ MORE

answered Apr 17, 2018 in Selenium by Meci Matt
• 9,420 points
1,232 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
548 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
882 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
546 views
0 votes
1 answer
0 votes
5 answers