简体   繁体   English

需要帮助才能在 puppeteer 中获取 xPath 的值

[英]Need help to get a value of an xPath in puppeteer

I whant to get the value of an exect xpath, that has a value of 1,400.我想得到一个 exect xpath 的值,它的值为 1,400。 Can not use span class name because their are multiple classes with the same class name.不能使用 span class 名称,因为它们是具有相同 class 名称的多个类。 So i have found out i have to use the Xpath.所以我发现我必须使用 Xpath。 Any suggestions?有什么建议么?

HTML:
<span class="currency-coins value">1,400</span>
Full xpath:
/html/body/main/section/section/div[2]/div/div/section[2]/div[2]/section/div[2]/ul/li[1]/div/div[2]/div[3]/span[2]/text()

代码图像

If the label is unique you can try:如果 label 是独一无二的,您可以尝试:

//*[contains(text(), 'Kjop na')][0]/following-sibling::*

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM