Html XPath:在跟随兄弟之后获取下一个
在下面的HTML代码中,我需要提取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
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']