简体   繁体   English

如何使用 selenium webdriver 在 JQGrid 中选择单选按钮

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

I am trying to select the Radio button in Jqgrid table.我正在尝试选择 Jqgrid 表中的单选按钮。 But I am unable to find its XPath.但我无法找到它的 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")) ).我建议通过它的唯一 id ( driver.findElement(By.id("gridRadio"))来选择它。 But if you explicitly want to use XPath, use one of the following expressions:但是,如果您明确想要使用 XPath,请使用以下表达式之一:

//input[@id='gridRadio']

or或者

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用带有Java的Selenium WebDriver选择单选按钮? - How to select radio button using Selenium WebDriver with Java? 如何通过不使用x路径来选择Selenium Webdriver中的单选按钮 - how to select radio button in selenium webdriver by not using x path 如何在Selenium Webdriver中选择单选按钮? 动态选择单选按钮 - How to select radio button in selenium webdriver ? dynamic select of radio button 为什么我没有使用selenium webdriver选择单选按钮? - Why am failing to select radio button using selenium webdriver? 使用带有Java的Selenium WebDriver在组中选择单选按钮 - Select Radio Button in a group using Selenium WebDriver with Java 如何使用 java 在 selenium webdriver 中使用 select 单选按钮和复选框? - how to select radio button & checkbox in selenium webdriver with java? 使用Selenium Webdriver选择PrimeFaces单选按钮 - Select a PrimeFaces radio button with Selenium Webdriver 如何使用 Selenium WebDriver 读取 ::after 单选按钮元素的属性 - How to read ::after attributes of a radio button element using Selenium WebDriver 如何使用Selenium WebDriver检查单选按钮? - How to check a radio button with Selenium WebDriver? 如何检查单选按钮是否在 Selenium WebDriver 中被选中? - How to check if the radio button is selected or not in Selenium WebDriver?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM