Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.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:选中复选框并单选';s通过it';的内部文本…是我的Xpath';对吗?_Xpath - Fatal编程技术网

Xpath:选中复选框并单选';s通过it';的内部文本…是我的Xpath';对吗?

Xpath:选中复选框并单选';s通过it';的内部文本…是我的Xpath';对吗?,xpath,Xpath,我发现有时候,缺少值“”。因此,我返回到查询规范化的内部文本 <label><input type="radio" name="addThree">A Radio</label> <label><input type="checkbox" name="hasPic"> A Checkbox </label> 在这种情况下,它应该起作用,但这不是最好的方法;最好省略参数以规范化空间(这样就相当于,它是输入元素的所有文

我发现有时候,缺少值“”。因此,我返回到查询规范化的内部文本

<label><input type="radio" name="addThree">A Radio</label>

<label><input type="checkbox" name="hasPic">   A Checkbox  </label>

在这种情况下,它应该起作用,但这不是最好的方法;最好省略参数以规范化空间(这样就相当于
,它是输入元素的所有文本内容的串联)。如果输入元素中有多个文本节点,那么按照您的方式使用它可能会导致问题,如果输入元素中还有注释或处理指令,则可能会出现问题

//label/input[normalize-space(text()) = "A Radio"]
//label/input[normalize-space(text()) = "A Checkbox"]