

在编辑器中用用这个Xpath公式定位元素报错//div[@class='content-item']//div[@class='msc-table'][not(ancestor::div[@class='md-overlay'])]//div[@class='md-table__body-wrapper']//tr/td[count(//div[@class='content-item']//div[@class='msc-table'][not(ancestor::div[@class='md-overlay'])]//div[@class='md-table__header-wrapper']//th[.//div[contains(normalize-space(.),'类型')]]/preceding-sibling::*) + 1][.//div[ends-with(normalize-space(.),'类')]]
我把div[ends-with(normalize-space(.),'类')]改成div[normalize-space(.)='类'],ends-with函数删除又可以定位了,查了下说是XPath 2.0+才支持这个函数