查找元素包含特定 "path" 属性

Find element contains specific "path" attribute

有人可以协助解决以下问题吗?

我加载了 2000 多个元素的地图,但其中只有一个(当前可见)具有元素“path”和属性 d 不同于零。为了便于理解,请参考以下截图:

试过这个:,但没有找到我要找的东西。

并且拥有这个 XPath:

//div[@id="map"]//div[contains(@class,"map")]//div[@class="leaflet-pane"]//div[@class="leaflet-pane2"]//*[name()='svg']//*[name()='path' and @d="M0 0"]

找到所有这些 (2000)。

我正在寻找的是这样的东西(虽然我找不到正确的解决方案)- 故意只是添加了 Xpath 的结尾。

总而言之,我需要 d 属性(内部路径)不包含值零:

//*[name()='svg']//*[name()='path' and @d(contains,"125")]

请协助,在此先感谢您。

根据您的描述,您正在寻找 d 属性值 not 等于 M0 0.[= 的定位器17=] 可以使用 not 运算符将其转换为 XPath。
请试试这个:

//div[@id="map"]//div[contains(@class,"map")]//div[@class="leaflet-pane"]//div[@class="leaflet-pane2"]//*[name()='svg']//*[name()='path' and(not(@d="M0 0"))]