簡體   English   中英

如何使用 selenium webdriver 在 JQGrid 中選擇單選按鈕

[英]How to select Radio button in JQGrid using selenium webdriver

我正在嘗試選擇 Jqgrid 表中的單選按鈕。 但我無法找到它的 XPath。

 `table id="list" class="ui-jqgrid-btable" tabindex="0" role="grid" aria-
  multiselectable="false" aria-labelledby="gbox_list" style="width: 940px;
  display: table;" cellspacing="0" cellpadding="0" border="0"> 
  <tbody>
  <tr class="jqgfirstrow" role="row" style="height:auto">
  <td role="gridcell" style="height:0px;width:20px;"></td>
  <td role="gridcell" style="height:0px;width:150px;display:none;"></td>
  </tr>
  <tr id="1" class="ui-widget-content jqgrow ui-row-ltr ui-state-highlight 
  gridRowSelect" role="row" tabindex="0" style="color: rgb(255, 0, 0);" 
  aria-selected="true">
  <td role="gridcell" style="text-align:center;" title="" aria-
  describedby="list_myradio">
  <input id="gridRadio" class="gridRadio" name="radio_list" type="radio">
  </td>`

我建議通過它的唯一 id ( driver.findElement(By.id("gridRadio"))來選擇它。 但是,如果您明確想要使用 XPath,請使用以下表達式之一:

//input[@id='gridRadio']

或者

//table[@id='list']/tbody/tr[@id='1']/td/input[@type='radio']

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM