0

I've some problem with Xpath syntax with html. I want to select an item which is into a div.

I have a Div define by an id : "popin".

In this div, I have a span with his id is "id_yes".

I can get the div with //DIV[contains(@id ,'popin')] but I failed to get the span element.

Have you a solution ?

1
  • 2
    You should post your XML as code, not prose. Commented Jul 3, 2017 at 13:11

1 Answer 1

2

If you have the ID, you can use: //span[@id="id_yes"]

If you want to be more specific, //div[@id="popin"]/span[@id="id_yes"]

That, assuming your IDs are unique.

Sign up to request clarification or add additional context in comments.

2 Comments

the id of the span is not unique, this is why I want to specify in which div the span is located.
Then you can use that second option, because it specifies the div with # popin and then finds the span inside that div.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.