<div class="btm0">Question 1
</div><span class="small"></span>
<span id="form2">
<span id="form2:j_idt4598" style="display: none;"></span><ul id="form2:radioButton" class="controls full-width">
<li>
<input class=" firepath-matching-node" name="form2:radioButton" id="form2:radioButton:0" type="radio"><label for="form2:radioButton:0"> Yes</label></li>
<li>
<input class=" firepath-matching-node" name="form2:radioButton" id="form2:radioButton:1" type="radio"><label for="form2:radioButton:1"> No</label></li>
</ul>
<span id="form2:errMessage"></span>
</span>
<div class="btm0">Question 2
</div><span class="small"></span>
<span id="form1">
<span id="form1:j_idt4617" style="display: none;"></span><ul id="form1:radioButton" class="controls full-width">
<li>
<input class=" firepath-matching-node" name="form1:radioButton" id="form1:radioButton:0" type="radio"><label for="form1:radioButton:0"> Yes</label></li>
<li>
<input class=" firepath-matching-node" name="form1:radioButton" id="form1:radioButton:1" type="radio"><label for="form1:radioButton:1"> No</label>
레이블 및 옵션 버튼이있는 위의 간단한 페이지가 있습니다.XPath를 사용하여 라디오 버튼 선택
XPath를 사용하여 '질문 1 - 예'를 선택하고 싶습니다.
올바른 '예'옵션 (질문 1 또는 질문 2 일 수 있음)을 선택하는 고유 한 XPath를 만드는 쉬운 방법이 있습니까? XPath를 하드 코딩하고 싶지 않습니다.
나는 부분적인 해결책을 시도했지만 난 단지 두 번째 'YES'옵션을 선택하세요 :
//*[contains(text(),'Question 1')]/following::label[contains(text(),'Yes')]
감사합니다. Markus, 내 문제에 대해 더 나은 해결책입니다. – Vikram