LambdaTest Community

Find answers, support, and inspiration from other users

Questions
LambdaTest Community
Answered

How can I select the right link text when I have multiple match results while locating web elements in Selenium?I

Latety i have been confused about how can I select the right link text when I have multiple match results while locating web elements in Selenium.

Up Vote Down Vote 0 Votes
Posted 4 months ago

Answers


Let me try to answer this one. I am new to selenium, but I might give you good advice.

First, I would use Firefox to find elements on the page.

Firefox is pretty much installed on most machines compare to Chrome.

In Firefox, please install extension called TruePath.

This extension will give you mouse right click menu on an element to view relative xpath.

If you have many elements with the same name, then you will need to use relative xpath method.

Now, when you clicked on an element and selected relative xpath, then you will see several element relative xpath definitions. Try to pick the simplest definition. Make sure to pick the one that will differ for each element name. Then, write the code with the simplest relative xpath selected and see if it will work. Make sure to run the entire test on all screens. If it does not work, then please pick different definition.

Up Vote Down Vote 0 Votes
Posted 3 months ago
207 Views
1 Answer
4 months ago