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
988 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,110 points
2,928 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
965 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,930 points
1,776 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,520 points
3,769 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31 in Selenium by Sri
• 2,970 points
4,751 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,890 points
2,731 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 2 in Selenium by Sri
• 2,970 points
3,094 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
20,314 views
0 votes
7 answers

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

Try this once driver.findElement(By.id("id")).sendKeys(Keys.CONT ...READ MORE

answered Sep 5 in Selenium by Sri
• 2,970 points
48,864 views