Matthew
Matthew

Reputation: 89

XPath of span element

How can I get Xpath of the following element:

<div class="datum">          
    <span>180 KM</span>
</div>

I need value "180 KM". I can't get it to work as this span element doesn't have any name.

Upvotes: 0

Views: 87

Answers (1)

alecxe
alecxe

Reputation: 474251

Rely on the class of the parent div:

//div[@class="datum"]/span/text()

Upvotes: 2

Related Questions