【问题标题】:How to target elements within custom directive with protractor?如何使用量角器定位自定义指令中的元素?
【发布时间】:2020-03-21 09:11:27
【问题描述】:

这是我正在使用的自定义指令:

<custom-select custom-model="newStuff">
   <div ng-if="itemsLoaded">
      <select ng-disabled="model.disabled" data-placeholder="test" class="select-search 
        select2-hidden-accessible" tabindex="-1" aria-hidden="true">
        <option ng-if="model.placeholder" value="" class="ng-scope"></option>
        <option value="XYZ">XYZ</option>
        <option value="ABC">ABC</option>
    </select>
    <span class="select2 select2-container>
         Has random stuff
    </span>
  </div>
</custom-select>

我正在尝试点击

<span class="select2 select2-container>

但我做不到。我应该如何在量角器上做到这一点?

【问题讨论】:

  • 请添加您的代码(到目前为止您已经尝试过的内容)以及您收到的错误

标签: angularjs automation protractor functional-testing


【解决方案1】:

你试过css吗?

element(by.css('[ng-if="itemsLoaded"] .select2.select2-container'));

或者只是类

element(by.css('.select2.select2-container'));

【讨论】:

    猜你喜欢
    • 2022-01-06
    • 2018-12-08
    • 2015-09-12
    • 2016-04-13
    • 2014-07-01
    • 1970-01-01
    • 2016-05-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多