我有這樣的代碼XPath來獲取複選框內標籤
<label>
<input type="radio" checked="checked" value="fOejPdlZIx83HA" name="btnRad">
Test1
</label>
<label>
<input type="radio" checked="checked" value="fdsaf4waff4sssd" name="btnRad">
Test2
</label>
<label>
<input type="radio" checked="checked" value="fg43fasd43wsat4" name="btnRad">
Test3
</label>
我想通過XPath來訪問取決於標籤文本的單選按鈕
我已經嘗試過多次的事情:
//input[@name='btnRad]']/following::*[contains(text(),'Test3')]
//label[text()='Test3']/input[@name='btnRad']
//*[contains(text(),'Test3')]
即使最後一個沒有任何回報,所以xpath認爲「Test3」不是標籤的文本...任何人都有一個想法如何做到這一點?
我測試了firefox中最後一個xpath查詢,使用了很棒的插件FirePath,它的工作原理 – emcas88
我真的不知道該怎麼告訴你......我也試過最後一個firepath,它沒有返回結果:/ – Etienne
我測試了在這個相同的頁面,它的工作,非常奇怪... – emcas88