[英]xpath to multiple tags with different classes and ids > output: text
I would like to search for all text that is within specific tags (eg:spans, divs, and so on ... any tag) that have a specific class AND id: 我想搜索具有特定类AND ID的特定标记(例如:spans,divs等...任何标记)内的所有文本:
so I came up with this xpath: 所以我想出了这个xpath:
//*[(@id='att1' and @class='att2') OR (@id='att3' and @class='att4')]/text()
but it does not work :( 但它不起作用:(
any help would be great! 任何帮助将是巨大的! thank you in advance!
先感谢您!
You just need to put OR
in lower case and it should work: 您只需要将
OR
为小写即可,它应该可以正常工作:
//*[(@id='att1' and @class='att2') or (@id='att3' and @class='att4')]/text()
(FYI the corresponding grammar rules − regarding XPath logical expressions − can be found in that section of the the W3C specification .) (仅供参考,有关XPath逻辑表达式的相应语法规则可在W3C规范的该部分中找到。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.