Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用 XPath 来选择具有不同类的节点。在这种情况下,只有两个。一个是“msg_head”,另一个是“msg_sub_head”。
以下是我经过数小时的谷歌搜索并在 Stack Overflow 上搜索后正在运行的字符串。我觉得我很接近,但并不完全在那里。
//*[contains(concat(' ',@class,' '),' msg_head') and (contains(concat(' ',@class,' '),' msg_sub_head'))]
看来您只是缺少contains 搜索参数末尾的空格。例如,在你拥有 的地方' msg_head',你实际上想要' msg_head '。
contains
' msg_head'
' msg_head '