如何使用量角器定位器定位子元素?

How do I locate child element using protractor locators?

您能否建议以下 DOM 中 <input> 元素的定位器? by.repeater 只能让我知道 <td> 元素。任何后续的量角器定位器都不会在下方定位 <input> 元素。提前致谢!

<table class="table table-striped table-hover">
    <thead>
    <tbody class="ng-scope" ng-repeat="devices in collection track by $index" >
        <tr class="ng-scope ng-isolate-scope"  st-select-row="devices" st-select-mode="single">
        <td>
            <chk-select class="ng-isolate-scope" emitselectedrec="selectedRows" chkmode="multiple" rowobj="clusters">
                <input type="checkbox" ng-transclude="" ng-click="pushToSelected(row)" uid="1">
           </chk-select>
        </td>
      </tr>
    </tbody>
</table>

如果您依赖 chk-select 元素及其 rowobj 属性怎么办:

element(by.css("chk-select[rowobj=clusters] input[type=checkbox]"));

您可以使用 JavascriptExecutior 驱动程序。我会尽快加强我的回答,但你可以用这个驱动程序做很多事情。

你的情况只是 element(by.css('input'))