Java 如何使用SeleniumWebDriver在JQGrid中选择单选按钮

Java 如何使用SeleniumWebDriver在JQGrid中选择单选按钮,java,selenium-webdriver,jqgrid,Java,Selenium Webdriver,Jqgrid,我正在尝试选择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">

我正在尝试选择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>`
`table id=“list”class=“ui jqgrid btable”tabindex=“0”role=“grid”aria-
multiselectable=“false”aria labelledby=“gbox\u list”style=“width:940px;
显示:表格;“cellspacing=“0”cellpadding=“0”border=“0”>
`

我建议通过它的唯一id(
driver.findElement(by.id(“gridRadio”))来选择它。
)。但是,如果明确希望使用XPath,请使用以下表达式之一:

//input[@id='gridRadio']


您可以尝试按id而不是用法来定位元素
XPah
driver.findElement(by.id(“elementId”)
。其中
elementId
可以是
gridRadio
。请参见别忘了添加。单击末尾的()
//table[@id='list']/tbody/tr[@id='1']/td/input[@type='radio']