Robot Framework:如何选择对应列的特定复选框,其文本应与给定表匹配

时间:2019-07-04 15:37:24

标签: python-3.x robotframework

我正在使用机器人框架自动执行一些测试用例,并且试图从表中找到用于选择复选框的xpath,该表的列中包含一些我需要与之匹配的文本以选择复选框。

我在xpath下面尝试过,但它给出了错误。

xpath = // table [@ id ='myTable'] / tbody / td / td / [contains(title(),'somename 123')

下面是HTML:

<table _ngcontent-c12="" class="table user-list-table" id="myTable" xpath="1">
          <thead _ngcontent-c12="">
            <tr _ngcontent-c12="">
              <th _ngcontent-c12="">
                <label _ngcontent-c12="" class="checkBoxWrapper ">
                  <input _ngcontent-c12="" id="listViewCheckAll" type="checkbox" class="ng-untouched ng-pristine ng-valid">
                  <span _ngcontent-c12="" class="checkmark"></span>
                </label>
              </th>
              <th _ngcontent-c12="" class="feature-sorting down" id="usernameHeader">Name

              </th>

              <th _ngcontent-c12="" class="feature-sorting down" id="empIDheader">EmployeeID</th>
              <th _ngcontent-c12="" class="feature-sorting down" id="emailIdheader">EmailID</th>
              <th _ngcontent-c12="" class="feature-sorting down" id="userroleHeader">UserRole

              </th>
              <th _ngcontent-c12="">Organisation</th>
              <th _ngcontent-c12="">No. of Branches</th>
              <th _ngcontent-c12="">No. of Laptops</th>

              <th _ngcontent-c12="">Branch's Name</th>
              <th _ngcontent-c12="">Branch's Email ID</th>
            </tr>
          </thead>
          <tbody _ngcontent-c12="">


            <!----><tr _ngcontent-c12="" class="ng-star-inserted">
              <td _ngcontent-c12="">
                <label _ngcontent-c12="" class="checkBoxWrapper ">
                  <input _ngcontent-c12="" class="usercb ng-untouched ng-pristine ng-valid" id="singleUserCheck" type="checkbox">
                  <span _ngcontent-c12="" class="checkmark"></span>
                </label>
              </td>
              <td _ngcontent-c12="" class="highlightedText" title="SomeName">
                <span _ngcontent-c12="" class="over_text_name_user"> <a _ngcontent-c12="" id="userNAmeLink7">SomeName</a></span>
              </td>
              <td _ngcontent-c12=""><span _ngcontent-c12="" class="over_text_employee_id">0001</span></td>
              <td _ngcontent-c12=""><span _ngcontent-c12="" class="over_text_email_id">abc@xyz.com</span></td>

              <td _ngcontent-c12="">Employee</td>
              <td _ngcontent-c12="">XYZ</td>
              <td _ngcontent-c12="" class="highlightedText"><a _ngcontent-c12="" id="BranchLink3">7</a></td>
              <td _ngcontent-c12="" class="highlightedText">
                <a _ngcontent-c12="" id="LaptopsLink3">1</a>
              </td>
              <td _ngcontent-c12=""><span _ngcontent-c12="" class="over_text_BranchName">B_Branch Branch</span></td>
              <td _ngcontent-c12=""><span _ngcontent-c12="" class="over_text_Branchemail_id">Branch@somebranch.com</span></td>
            </tr><tr _ngcontent-c12="" class="ng-star-inserted">
              <td _ngcontent-c12="">
                <label _ngcontent-c12="" class="checkBoxWrapper ">
                  <input _ngcontent-c12="" class="usercb ng-untouched ng-pristine ng-valid" id="singleUserCheck" type="checkbox">
                  <span _ngcontent-c12="" class="checkmark"></span>
                </label>
              </td>
              <td _ngcontent-c12="" class="highlightedText" title="SomeName123">
                <span _ngcontent-c12="" class="over_text_name_user"> <a _ngcontent-c12="" id="userNAmeLink3">SomeName123</a></span>
              </td>
              <td _ngcontent-c12=""><span _ngcontent-c12="" class="over_text_employee_id">0002</span></td>
              <td _ngcontent-c12=""><span _ngcontent-c12="" class="over_text_email_id">xyz@abc.com</span></td>

              <td _ngcontent-c12="">Employee</td>
              <td _ngcontent-c12="">ABC</td>
              <td _ngcontent-c12="" class="highlightedText"><a _ngcontent-c12="" id="BranchLink3">0</a></td>
              <td _ngcontent-c12="" class="highlightedText">
                <a _ngcontent-c12="" id="LaptopsLink3">0</a>
              </td>
              <td _ngcontent-c12=""><span _ngcontent-c12="" class="over_text_BranchName"></span></td>
              <td _ngcontent-c12=""><span _ngcontent-c12="" class="over_text_BranchNamemail_id">somebranch@somebranch.com</span></td>



      </tbody>
    </table>

我希望确切的xpath从我无法找到的表中针对用户someName 123选择复选框。

请帮助我找到xpath以便从表中选中文本(名称)复选框。

0 个答案:

没有答案