Robotframework 如何根据文本选择复选框

Robotframework 如何根据文本选择复选框,robotframework,Robotframework,如何基于文本值选中复选框 1。文本值是动态的,与复选框分开 2。我只需要在文本存在时选中复选框 以下是HTML代码: <input type="checkbox" name="_Adjustment3" headerid="226849" detailid="380105" onchange="enableDisableAmountBox(this)" class="ace" xpath="1"> <span class="lbl" xpath="1">

如何基于文本值选中复选框

1。文本值是动态的,与复选框分开

2。我只需要在文本存在时选中复选框

以下是HTML代码:

<input type="checkbox" name="_Adjustment3" headerid="226849" detailid="380105" onchange="enableDisableAmountBox(this)" class="ace" xpath="1">
    <span class="lbl" xpath="1">
        <a href="#"/>
    </span>
</td>
<td xpath="1">AutomatedSchedule$03/04/2019, $, $, $, $</td>
<td xpath="1">10000</td>

自动时间表$03/04/2019,$,$,$,$$
10000

我想选中基于文本的复选框(即AutomatedSchedule$03/04/2019,$,$,$,$,$,$)

我假设文本
AutomatedSchedule
是常量,其余文本正在更改

在这种情况下,使用contains并在side td标记中查找子字符串

  • 使用文本包含的
    AutomatedSchedule
    标识
    td
    标记
  • 然后使用前面的同级td,其中包含
    输入
    复选框
  • 使用“等待直到元素可见”
  • 然后单击元素
  • Wait Until Element Is Visible   xpath://td[contains(.,'AutomatedSchedule')]/preceding-sibling::td[1]/input[@type='checkbox']      10
    
    Click Element    xpath://td[contains(.,'AutomatedSchedule')]/preceding-sibling::td[1]/input[@type='checkbox']