I found an object with specific class:
THREAD = TREE.find_class(\'thread\')[0]
Now I want to get all elements that a
I'm not sure, but it seem that your problem is in HTML itself: note that there are couple Tag omission cases applicable for p nodes, so closing tags of paragraphs
first
second
simply ignored by parser and both nodes identified as siblings, but not parent and child, e.g.
first
second
So XPath //div[@class="thread"]/p
will return you both paragraphs
You can simply replace p
tags with div
tags and you'll see different behaviour:
first
second
Here //div[@class="thread"]/div
will return first node only
Please correct me if my assumption is incorrect