确定用于捕获对象的正确定位器

Identify correct Locators forCapturing Objects

本文关键字:定位器 对象 用于      更新时间:2023-09-26

我是使用量角器进行楼宇自动化的新手。

您能否帮助我确定我可以使用哪个定位器来捕获量角器测试中的文本框字段元素?

以下是我从Firebug捕获的HTML:

input class="input ng-pristine ng-valid" type="text" ti-autosize="" ti-bind-attrs="{type: options.type, placeholder: options.placeholder, tabindex: options.tabindex, spellcheck: options.spellcheck}" ng-class="{'invalid-tag': newTag.invalid}" ng-trim="false" ng-paste="eventHandlers.input.paste($event)" ng-blur="eventHandlers.input.blur($event)" ng-focus="eventHandlers.input.focus($event)" ng-keydown="eventHandlers.input.keydown($event)" ng-change="eventHandlers.input.change(newTag.text)" ng-model="newTag.text" placeholder="20 numbers remaining" style="width: 135px;" spellcheck="true"

有多种方法可以找到元素,例如:

  • by.model

    element(by.model('newTag.text'))
    
  • by.css

    element(by.css('input.input'))