【问题标题】:Click on table cell value in protractor单击量角器中的表格单元格值
【发布时间】:2019-06-21 11:12:06
【问题描述】:

我有一个包含图像、文本和数字的值表。 我想点击一个特定的文本,但没能做到。我是使用量角器进行 e2e 测试的新手,所以请帮忙。

我需要点击文本“由测试自动化创建”

<td class="custom-t-act mat-cell cdk-column-name mat-column-name ng-tns-c15-3 ng-star-inserted"
    _ngcontent-c15="" mat-cell="" role="gridcell">
  <h5 _ngcontent-c15="" class="mb-0 pointer" tabindex="0"
      ng-reflect-router-link="/projects/created-by-test-auto">
    <b _ngcontent-c15="" class="ng-tns-c15-3">Created by Test Automation</b>
  </h5>
</td>

【问题讨论】:

    标签: javascript angularjs automation protractor automated-tests


    【解决方案1】:

    如果您确切知道那里的文本,那么您正在寻找by.cssContainingText

    element(by.cssContainingText('b', 'Created By Test Automation')).click();
    

    否则,你可以这样做

    $('[ng-reflect-router-link="/projects/created-by-test-auto"]').click();
    

    使用设置为/projects/created-by-test-autong-reflect-router-link 指令准确单击h5 指令。

    【讨论】:

      猜你喜欢
      • 2014-12-13
      • 2020-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-28
      • 2012-12-12
      相关资源
      最近更新 更多