Reputation: 59
Problem Statement: I have been facing the issue for selecting following web element. (Actually these are the texts)
HTML Code:
<tr class="inputtextfields" bgcolor="#CDDBE9">
<td width="12%" height="25">
<div align="center">Firstname1234Lastname</div></td>
<tr class="inputtextfields" bgcolor="#CDDBE9">
<td width="12%" height="25"> <div align="center">Firstname45671Lastname</div></td>
What am I looking for?
I am looking for the locating "Firstname1234Lastname" element or text by Web Driver using Java
language. Your help is highly appreciated.
Upvotes: 0
Views: 128
Reputation: 52665
You can try below XPath
to locate required elements:
"(//tr[@class='inputtextfields']/td/div)[1]" // For "Firstname1234Lastname"
and
"(//tr[@class='inputtextfields']/td/div)[2]" // For "Firstname45671Lastname"
Upvotes: 1