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
3,142 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,150 points
14,776 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 29, 2019 in Selenium by Shreya
2,902 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
• 28,140 points
4,042 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,500 points
13,673 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,190 points
9,142 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,910 points
7,221 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 3, 2020 in Selenium by Sri
• 3,190 points
7,874 views
0 votes
3 answers

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

Try using List <WebElement> to access all similar elements ...READ MORE

answered Dec 16, 2020 in Selenium by Roshni
• 10,480 points
87,425 views
0 votes
8 answers

How to open a link in new tab of chrome browser using Selenium WebDriver?

This below code works for me in ...READ MORE

answered Dec 14, 2020 in Selenium by Gitika
• 65,770 points
103,022 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP