I want the xpath count of all the Top Employers in the Naukri.com site.
I used.
StoreXpathCount
//h2[text()="Top Employers"]//following::text(),'bann开发者_如何学编程er'
In the above code i want the total number of xpaths which contain Banner text in their name.
But it is not working. Please help me out.
Of course, this is not valid XPath syntax
//h2[text()="Top Employers"]//following::text(),'banner'
It looks like you want the following sibling table
, so:
//h2[.="Top Employers"]/following-sibling::table[1]
Note: //
operator means /descendant-or-self::node()/
, so you don't need it for the second step.
But your question was:
I want the xpath count of all the Top Employers
I guess that would be the count of tr
:
count(//h2[.="Top Employers"]/following-sibling::table[1]/tr)
Note: The source it's not aviable so I couldn't check if tbody
element was present in the source or added by browser.
精彩评论