简体   繁体   中英

How to select Radio button in JQGrid using selenium webdriver

I am trying to select the Radio button in Jqgrid table. But I am unable to find its 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>`

I would suggest to select it by its unique id ( driver.findElement(By.id("gridRadio")) ). But if you explicitly want to use XPath, use one of the following expressions:

//input[@id='gridRadio']

or

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM