Issue
I have created below XPath but it is not working as expected.
I am checking text in the cell of a html table and I want a particular cell to be matched.
I have created below XPath but it is not working.
*//table[@id="customerPortalTable"]//tbody//tr[td[ contains(translate(text(), "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), "{0}") ]]
{0}
- This is the place holder for value to search
I want to match below values
Test Account or TEST ACCOUNT or Test ACCOUNT
<td class="left filterInputColumn">Test Account</td>
<td class="left filterInputColumn">Test ACCOUNT</td>
<td class="left filterInputColumn">TEST ACCOUNT</td>
Solution
Generally your XPath looks ok to me. Maybe the issue is connected with whether you search uppercase or lowercase, for example these both are returning the three td nodes:
//td[contains(translate(text(), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 'TEST ACCOUNT')]
//td[contains(translate(text(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'test account')]
Answered By - K. B.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.