简体   繁体   中英

I need help to get the xpath of the value which is under p tag inside the header

Can you please help me in extracting ingredient list inside the

tag. I tried few things and was able to get till header - Ingredients. I am look to extract the value. Path i tried - //DIV[@id="important-information"]//h4[text()='Ingredients:']/text()

enter image description here

You can use this xpath to locate the 2nd p tag element highlighted in the image. Below xpath can be used in automation as it will return the web element-

//div[@id="important-information”]//div[2]//p[2]

And if you directly want to get the text from xpath then use below xpath-

//div[@id="important-information”]//div[2]//p[2]/text()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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