Matching by text isn't something you can do with plain CSS Selectors, but it is supported in jQuery and xPath, if they are possible for you to use.(使用纯文本选择器无法实现按文本匹配,但是如果您可以使用,则jQuery和xPath支持它。)
The jQuery :contains()
selector:(jQuery :contains()
选择器:)
$('div:contains("yourText")')
The xPath text()
selectors(xPath text()
选择器)
$x('//div[text()="yourText"]') // Match
$x('//div[contains(text(), "yourText")]') // Substring / Contains
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…