如何根据行量角器中的文本单击表中的链接

时间:2014-05-26 12:36:03

标签: javascript angularjs karma-runner protractor

Angular JS - 量角器

如何根据行表中的范围文本“BG558”单击“选项”菜单。有很多行。请一些人帮我使用量角器

<tr class="ng-scope" ng-style="styleForDownLineActivities)" ng-class="ficGridAlert" bn-log-dom-creation="With" ng-repeat="baseLocationAndActivities in LocationAndActivities | baseLocationFilter:searchCriteria track by baseLocationAndActivities.baseNumber">
<td class="ng-binding" style="width : 30px"></td>
<td class="ng-binding" style="width : 30px">24</td>
<td style="width : 49px">
    <tlr-station-c>
        <span class="ng-binding ficSmartMenu" fic:circ7="baseLocationAndActivities.systemC" ng-class="ficSmartMenu" ng-show="editCriteria">BG558</span>  <!-- Based on this text -->
        <div class="ng-hide" ng-show="editCriteria">
    </tlr-station-c>
</td>
<td style="width : 102px">
    <td class="ng-binding" style="width : 30px">UT</td>
    <td style="width : 30px">
        <td style="width : 30px">
            <td style="width : 25px">
                <td style="width : 25px">
                    <td style="width : 25px">
                        <td style="width : 25px">
                            <td style="width : 25px">
                                <td style="width : 25px">
                                    <td style="width : 25px">
                                        <td style="width : 75px">
                                            <td style="width : 75px">
                                                <td style="width : 75px">
                                                    <td align="center" style="width : 65px">
                                                        <span class="ficSmartMenu ng-scope" ng-if="(!baseEditableMode && !baseCEditMode && FSNNum < 0)">
                                                            Options <!-- I should able to click this element -->
                                                        </span>
                                                    </td>

1 个答案:

答案 0 :(得分:0)

我得到了解决方案。我使用了xpath

element(by.xpath("//span[contains(.,'BG558')]/following::span[contains(.,'Options')][1]").click();