Issue
I want to write a common XPath for the result displayed for my searched text 'Automation Server'
The same text is displayed for td
HTML tags as well as for div
html tags as shown below, and I wrote XPath as below based on my understanding by going through different article
displayed_text = //td[contains(text(),'Automation Server') or div[contains(text(),' Automation Server ')]
<td role="cell" mat-cell="" class="mat-cell cdk-cell cdk-column-siteName mat-column-siteName ng-star-inserted">Automation Server</td>
<div class="change-list-value ng-star-inserted"> Automation Server </div>
Solution
The operator you are looking for in XPath is |
. It is a union operator and will return both sets of elements.
The XPath you are looking for is
//td[contains(text(),'Automation Server')] | //div[contains(text(),'Automation Server')]
Answered By - JeffC
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.