简体   繁体   English

如何找到具有多个包含条件的 xpath

[英]How to finding xpath with multiple contains conditions

there is a table in td that can find the link or plugin icon. td 中有一个表格可以找到链接或插件图标。 The image of this cell can be as like this .这个细胞的图像可以是这样的。

The xpath I want to find is only the cell with the link icon.我要查找的 xpath 只是带有链接图标的单元格。 How can I find XPath that will give that cell because the "Password Security" cell, which is the photos above, has only the link icon?我怎样才能找到 XPath 将给出该单元格,因为上面的照片中的“密码安全”单元格只有链接图标?

Table Css here表 Css 在这里

When I tried the following code, it gave the cell , which is both the link and the plugin icon.当我尝试以下代码时,它给出了 cell ,它既是链接又是插件图标。

//table[@id='DataTables_Table_1']//tbody//td//i[contains(@class,'fa fa-link') and not(contains(@class,'fa-paperclip'))]

It was a solution for me to list the cells that do not contain the plugin icon and have icon.列出不包含插件图标但有图标的单元格对我来说是一个解决方案。

//table[@id='DataTables_Table_1']//td[3][not(i[contains(@class,'fa-paperclip')]) and (i)]

You can use:您可以使用:

//table//td[not(self::td[i[contains(@class,'fa-paperclip')]])]

Output: Password Security node Output:密码安全节点

Or less secure:或者不太安全:

//table//td[count(./i)=1 and i[@class="fa fa-link mailIcon"]]

Output: Password Security node Output:密码安全节点

Why don't you use the classic form and search for text?为什么不使用经典表单并搜索文本? :

//table//td[text()[1][contains(.,"Password Security")]]

Output: Password Security node Output:密码安全节点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM