eykxas
eykxas

Reputation: 3

XPath selecting specific child element

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 ?

Upvotes: 0

Views: 113

Answers (1)

callback
callback

Reputation: 4122

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.

Upvotes: 2

Related Questions