vloryan vloryan - 1 year ago 42
PHP Question

xpath - select classes after specific text in php

I would like to find nodes after a specific text inside an HTML page.
The text is

Search results: Hits
and the class I am looking for is successfully found using
//a[contains(@class,"tooltip")]
. I have tried

//*[contains(., "Search results: Hits")]/following:://a[contains(@class,"tooltip")]


but I do not get the results I was hoping. Actually, I get no results at all. I guess you know why? Thanks for your help!

Answer Source

You should remove // before a as

//*[contains(., "Search results: Hits")]/following::a[contains(@class,"tooltip")]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download