dark_space
dark_space

Reputation: 179

If span class contains certain text

I have this html here

<span id="js_11" class="timestampContent">December 16, 2013</span>

I want to check if the span class contains the value 2013. How should i write the xpath?

These are what i have tried so far and they are either invalid or has no matching nodes according to Firepath.

//span[@class='timestampContent']//span[contains(text(), '2013')]
//class[contains(text(), '2013')]
//@class="timestampContent" //span[contains(text(), '2013')]

Upvotes: 1

Views: 1537

Answers (1)

har07
har07

Reputation: 89285

You can simply combine the 2 conditional check using and operator, like so :

//span[@class='timestampContent' and contains(text(), '2013')]

Upvotes: 3

Related Questions