Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.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/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
Html XPath:在跟随兄弟之后获取下一个_Html_Xpath - Fatal编程技术网

Html XPath:在跟随兄弟之后获取下一个

Html XPath:在跟随兄弟之后获取下一个,html,xpath,Html,Xpath,在下面的HTML代码中,我需要提取class=“list item child label ng inserted”,但仅在我选中class=“fat checkbox”的部分中提取 文本AAA 文本BBB 文本AAA 文本BBB 我尝试构建的这些XPath: '//div[contains(@class,“list item child label ng inserted”)]/祖先::span//div//fat checkbox[contains(@class,“mat checkbo

在下面的HTML代码中,我需要提取
class=“list item child label ng inserted”
,但仅在我选中
class=“fat checkbox”的部分中提取


文本AAA
文本BBB
文本AAA
文本BBB
我尝试构建的这些XPath:

'//div[contains(@class,“list item child label ng inserted”)]/祖先::span//div//fat checkbox[contains(@class,“mat checkbox checked”)]

'//span//div//fat复选框[包含(@class,“fat复选框已选中”)]/以下同级::div[2]'

'//span//div//fat复选框[包含(@class,“fat复选框已选中”)]/以下同级::div[包含(@class,“列表项子标签已插入”)]

仅获取我
class=“列表项子标签”


任何人都知道如何构建正确的xpath,以便在不使用contains(@text)的情况下,通过选中
class=“fat复选框”
获得插入的
class=“list item child label ng”

请尝试在xpath下面选择所需的节点

//div[fat-checkbox[@class="fat-checkbox-checked"]]/following-sibling::div[@class="list-item-child-label ng-inserted"]

请尝试在XPath下面选择所需的节点

//div[fat-checkbox[@class="fat-checkbox-checked"]]/following-sibling::div[@class="list-item-child-label ng-inserted"]

要定位元素
后接元素
,可以使用以下任一选项:


要定位元素
后接元素
,可以使用以下任一选项:

//fat-checkbox[@class='fat-checkbox-checked']//following::div[@class='list-item-child-label ng-inserted']