Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
xpath的通配符用法_Xpath - Fatal编程技术网

xpath的通配符用法

xpath的通配符用法,xpath,Xpath,我在使用xpath选择以下两个标记时遇到问题: <div class="table-row"> <div class="table-row "> 但这与上述任何一项都不匹配 我做错了什么?谢谢您的帮助。使用以开头以匹配通配符'*' //div[starts-with(@class, 'table-row')] 使用以开头以匹配通配符的位置 //div[starts-with(@class, 'table-row')] 还有//div[contains(@class,

我在使用xpath选择以下两个标记时遇到问题:

<div class="table-row">
<div class="table-row ">
但这与上述任何一项都不匹配


我做错了什么?谢谢您的帮助。

使用
开头以匹配通配符
'*'

//div[starts-with(@class, 'table-row')]

使用
开头以匹配通配符的位置

//div[starts-with(@class, 'table-row')]

还有//div[contains(@class,'table row')]@stav:
contains
在这种情况下不应使用。由于
包含的
将与类匹配,如
测试表行
测试表行测试
测试1表行
。。。很快。而且//div[contains(@class,'table row')]@stav:
contains
在这种情况下不应使用。由于
包含的
将与类匹配,如
测试表行
测试表行测试
测试1表行
。。。很快。