简体   繁体   中英

How do I locate child element using protractor locators?

Can you suggest locator for <input> element in the following DOM? by.repeater only gets me till <td> element. Any subsequent protractor locator is not locating <input> element underneath. Thank you in advance!

<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属性,该rowobj

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

you can use JavascriptExecutior driver. I will enhance my answer soon but you can do alot with this driver.

在你的情况下,它只是element(by.css('input'))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM