简体   繁体   English

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

[英]How do I locate child element using protractor locators?

Can you suggest locator for <input> element in the following DOM? 您可以建议以下DOM中<input>元素的定位符吗? by.repeater only gets me till <td> element. by.repeater只会让我直到<td>元素。 Any subsequent protractor locator is not locating <input> element underneath. 任何后续的量角器定位器均未在其下定位<input>元素。 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. 您可以使用JavascriptExecutior驱动程序。 I will enhance my answer soon but you can do alot with this driver. 我将尽快提高答案,但是您可以使用此驱动程序做很多事情。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Protractor 在表格中定位单元格 - How can I locate the cell in a table using Protractor 量角器:如何定位给定元素的同级? - Protractor: How to locate a sibling of a given element? 量角器“陈旧的元素参考:元素未附加...如何解决此问题? - Protractor "stale element reference: element not attached… How do I fix this? 使用链接在量角器中获取直接子元素 - Getting direct child element in protractor using chaining 量角器:如何使用href子串或span子串单击元素? - Protractor: How do I click on an element using the href substring or span substring? 量角器找不到元素/值 - Protractor cannot locate a element/value 如何使用Selenium或Protractor获取HTML中嵌套元素的文本以实现自动化? - How do i get the text of a nested element in HTML for automation using Selenium or Protractor? 量角器 - 如何通过自定义(非HTML)属性定位元素? - Protractor - How to locate element by custom (non HTML) attributes? 如何在量角器中按类型,值或alt属性定位元素? - How to locate element by type, value or alt attribute in protractor? 如何在 Python 中使用 Selenium 找到定位所需元素的正确方法? - How do I find the right way to locate the needed element using Selenium in Python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM