Here's what the relevant part of my DOM looks like:
<div class="questions" xpath="1">
<div class="question">
<div class="section-name">General Knowledge</div>
<div class="title" style="">Which of these cities is the capital of India?</div>
<span class="description">Some description text</span>
<div class="options">
<div class="mui-radio"><label for="x7xvolm-116"><input id="x7xvolm-116" type="radio" value="116" style=""><span class="option-text">Mumbai</span></label></div>
<div class="mui-radio"><label for="x7xvolm-117"><input id="x7xvolm-117" type="radio" value="117"><span class="option-text">Delhi</span></label></div>
<div class="mui-radio"><label for="x7xvolm-118"><input id="x7xvolm-118" type="radio" value="118"><span class="option-text">Kolkata</span></label></div>
<div class="mui-radio"><label for="x7xvolm-119"><input id="x7xvolm-119" type="radio" value="119"><span class="option-text">Chennai</span></label></div>
<div class="mui-radio"><label for="x7xvolm-120"><input id="x7xvolm-120" type="radio" value="120"><span class="option-text">Bengaluru</span></label></div>
<div class="mui-radio"><label for="x7xvolm-121"><input id="x7xvolm-121" type="radio" value="121"><span class="option-text">Nagpur</span></label></div>
</div>
</div>
I need to come up with an XPath that would have two arguments which would help me select the required option from Selenium code:
- Question title (
Which of these cities is the capital of India?
) - Option label (
Delhi
)