<div data-ng-transclude="" data-ng-style="{fontSize:fontSize}" layout="column" layout-align="center center" flex="25" data-fittext="" data-fittext-max="16" style="margin: 5px 10px 5px 1px; font-size: 5.7px;" class="ng-scope">
<span class="ng-scope"> </span>
<span style="color: #ebeded; font-size: 12px;" class="ng-binding ng-scope">UPCHARGE</span>
</div>
我想确定是否存在带有文本“UPCHARGE”的span元素。如何用量角器识别元素。
答案 0 :(得分:0)
您可以使用byCssContainingText + isPresent()
var elm = element(by.cssContainingText('span', 'UPCHARGE'));
expect(elm.isPresent()).toBe(true);
http://www.protractortest.org/#/api?view=ProtractorBy.prototype.cssContainingText http://www.protractortest.org/#/api?view=ElementFinder.prototype.isPresent