How to click the <a> tag in selenium
Below is my code. Paste the entire tag
<TR id="oldcontent" bgcolor="#D0D0D0"> <TD id="oldcontent">Foot-OM</TD> <a id="oldcontent" href="ID=22143"><u>Re-Submit</u></a> <a id="oldcontent" href="ID=22143"><u>View</u></a> <TR> Here I need to click the tag using the re-send text. The problem is href = "ID = 22143", the id value is generated dynamically every time I run a test case. Therefore, I need to click the Re-submit tag, using the text present in the first text, i.e. Foot-OM.Can, someone will provide me with xpath>
+4
4 answers
It looks like your problem is with the wrong HTML structure. The <a> tag cannot be placed in <tr> . Only <td> is allowed. The browser "fixes" errors, and <a> tags are displayed outside the table, and the DOM structure does not coincide with html.

This XPath works for the image above.
//td[text()='Foot-OM']/../../../../a[//text()='Re-Submit'] 0