Answered

xpath question

Hi, I have multiple radio elements that are similar but some have one tag that is different (please see the tag in bold)...

<input id="yesNoRadio" class="yesNoRadio" type="radio" disabled="" data-radio-type="yes-no-radio" name="question-id-9477" data-question-id="4548" data-checklist-question-id="9477" data-comments-required="false" data-comment-on-answer="ALWAYS" value="NO">

<input id="yesNoRadio" class="yesNoRadio" type="radio" data-radio-type="yes-no-radio" name="question-id-7129" data-question-id="124" data-checklist-question-id="7129" data-comments-required="false" data-comment-on-answer="ALWAYS" value="NO">

 

.. relative xpath that I am using is as follows..

//input[@id='yesNoRadio' and @value= 'NO']

 

... and I do not want any radio element with the disabled="" tag, how can I have it excluded with the xpath? Thanks.

 

0
3 comments
Avatar
Joseph Hamdan

Hi Stephen,

You can use this XPath:

//input[@id='yesNoRadio' and @value= 'NO' and not(@disabled)]

Regards,
Subject7 Team

0
Comment actions Permalink
Avatar
Abayomi Akinpelumi

That worked! Thanks Joseph!

0
Comment actions Permalink
Avatar
Joseph Hamdan

You're welcome! We're glad we could help.

Have a great weekend!

Regards,
Subject7 Team

0
Comment actions Permalink

Please sign in to leave a comment.