In my webpage, there's a div class named Test. How can I find it with XPath? or am I doing it wrong?
+3
A:
This selector should work but will be more efficient if you replace it with your suited markup:
//*[contains(@class, 'Test')]
meder
2009-10-22 01:00:07
with my suited markup? Sorry, I'm not sure what did that part mean.
Doug
2009-10-22 05:50:19
It means that I gave you a generic non-efficient answer that should work, but because you provided no xml whatsoever I couldn't make it efficient so you would have to suite it towards your markup. And did it work?
meder
2009-10-22 05:52:35
I'll have to get back to you on that question.
Doug
2009-10-22 06:02:33
@meder: More like `//div[contains(concat(' ', @class, ' '), ' Test ')]` - Yours will turn up partial matches as well.
Tomalak
2009-10-22 16:32:57
your xpathfu is strong :)
meder
2009-10-22 16:51:51