How can I extract ingredient list inside the <p>
tag? I tried few things and was able to get till header - Ingredients. I am look to extract the value which should be aligned with header - Ingredients.
Path I tried:
//DIV[@id="important-information"]//h4[text()='Ingredients:']/text()
Image:
CodePudding user response:
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()