divz
divz

Reputation: 7967

Find value using Xpath

I need to get the selected radio button's value(82) using Xpath. I am not familiar with Xpath. How could I get the text 82 using Xpath?

<label id="thankyou_label" class="itemName radio" for="thankyou_radio">
<input id="thankyou_radio" class="cardFilterItemSelection" type="radio" name="occasionGroup" value="Thank You" tagtype="Occasion" checked="checked">
<span class="occasion_display_name">Thank You </span>
<span class="itemCount">(82)</span>
</label>

Upvotes: 0

Views: 881

Answers (2)

Psl
Psl

Reputation: 3920

Please Try this.you can use following code without using xpath.Cheers

   page.find('.itemCount').text

Upvotes: 2

Arup Rakshit
Arup Rakshit

Reputation: 118299

The xpath that you can use here is:

//input[@class = 'cardFilterItemSelection' and @checked = 'checked']/following-sibling::span[@class = 'itemCount']/text()

Upvotes: 1

Related Questions