Can I get an element if its class contains some text?
如果它的类包含一些文本,我可以获得一个元素吗?
Example:
例:
<div class="headerbody"></div> - match (header)
<div class="headerbottom"></div> - match (header)
<dov class="text"></div> - not match (header)
1 个解决方案
#1
50
you could use contains()
in your XPath predicate. like this:
你可以在XPath谓词中使用contains()。喜欢这个:
div[contains(@class, 'header')]
#1
50
you could use contains()
in your XPath predicate. like this:
你可以在XPath谓词中使用contains()。喜欢这个:
div[contains(@class, 'header')]