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, 2019 in Selenium by Yash
484 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, 2019 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, 2019 in Selenium by Anvi
• 14,010 points
412 views
0 votes
1 answer

How can I locate web elements from a web page using Selenium Webdriver?

Hey @Dushyant, Locating elements in WebDriver is ...READ MORE

answered May 28, 2019 in Selenium by Shreya
489 views
0 votes
1 answer
0 votes
1 answer

How can I locate inline elements from a web page using Selenium Webdriver?

Which specific element you are trying to ...READ MORE

answered Oct 10, 2019 in Selenium by Abha
• 27,800 points
1,190 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
2,213 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,870 points
1,821 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,870 points
1,815 views
0 votes
1 answer

How to print text from a list of all web elements with same class name in Selenium?

@Rajni, following test case is somewhat similar ...READ MORE

answered Jun 20, 2019 in Selenium by Avantika
7,989 views
0 votes
5 answers