I needed to verify that there are only 3 companies displayed on the page. They are located inside of an anchor > div > div with the class Pod.
I wanted to do a verifyXpathCount | Xpathlocation | 3, but the rest of the content on the page, unfortunately was also inside of divs with the "Pod" class, so it was failing.
The code on the page looks something like this:
<div class="Pod">
<div>
<a href="/folderName/business_pageName.do?TargetID=companyName1">
CompayName1
</a>
</div>
<div>CompanySubHeading1</div>
<p></p>
</div>
<div class="Pod">
<div>
<a href="/folderName/business_pageName.do?TargetID=companyName2">
CompayName2
</a>
</div>
<div>CompanySubHeading2</div>
<p></p>
</div>
I tried various Xpath syntaxes, but none worked correctly:
//div[@class="Pod"]/div/a[@href=contains(text(),"business")]
//div[@class="Pod"]/div/a[@href,contains(text(),"business")]
//div[@class="Pod"]/div/a[contains(text(),"business")]
//div[@class="Pod"]/div/a[contains(text(),"business")]/@href
//div[@class="Pod"]/div/a/@href[contains(text(),"business")]
//div[@class="Pod"]/div/a/@href[text(),"business"]
Solution:
verifyXpathCount | //div[@class="Pod"]/div/a[contains(@href,"business")] | 3 |
Thank you Martin!
No comments:
Post a Comment