[英]selenium : Click on dynamic radio button using python
我正在嘗試單擊動態網頁上的單選按鈕。 我嘗試了classname,xpath,但沒有任何效果。
包含單選按鈕的代碼為:
<input id="radiofield-1247-inputEl" class="x-form-field x-form-radio x-form-cb" type="button" hidefocus="true" autocomplete="off" role="radio">
按鈕旁邊有一個標簽。
<label id="radiofield-1247-boxLabelEl" class="x-form-cb-label x-form-cb-label-after" for="radiofield-1247-inputEl">Yes</label>
我試過了 :
driver.find_element_by_xpath("//*[@type='radio'][@class='#class here'") #.click() and this doesn't work.
我嘗試傳遞絕對的xpath,這也失敗了。 沒有要搜索的名稱或ID。
您正在嘗試使用type="radio"
而在提供的HTML
上是type="button"
...
嘗試遵循XPath
:
driver.find_element_by_xpath('//input[contains(@id, "radiofield-")][@role="radio"]')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.