gpt4 book ai didi

dom - 使用 Xpath 包含 ID?

转载 作者:行者123 更新时间:2023-12-03 18:29:34 25 4
gpt4 key购买 nike

<div id="content-body-14269002-17290547">
<p>...</p>
<p>...</p>
<p>...</p>
<p>...</p>
<p>...</p>
</div>

我需要选择 id = "content-body*" 中的所有内容

每个页面上的 content-body 更改,可能需要 使用通配符 ?

最佳答案

大概 xpath search for divs where the id contains specific text复制

无论如何,

对于 ID

//div[contains(@id,"content-body")]//p #to Select all Paragraphs 

//div[contains(@id,"content-body")]//p//text() # To Select all text in Paragraphs

类(class)
//*[contains(@class,"content-body")//p
//div[contains(@class,"content-body")]//p//text()

课中课
//*[contains(@class,"content-body") and contains(@class,"another-sub-content-body")]//p//text()

希望能帮助到你 !!!

关于dom - 使用 Xpath 包含 ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42186747/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com