Javascript 使用量角器获取具有特定属性值的跨度的子元素

Javascript 使用量角器获取具有特定属性值的跨度的子元素,javascript,angularjs,protractor,angular-ui-bootstrap,popover,Javascript,Angularjs,Protractor,Angular Ui Bootstrap,Popover,我想用量角器测试一下弹出的爆米花。这是我的html。popover位于最后一个子跨度中: <span tariff-popover="views/popovers/c2g/airport.html" class="ng-isolate-scope"> <span ng-transclude=""> <span class="ng-scope"> Flughafenpauschale </sp

我想用量角器测试一下弹出的爆米花。这是我的html。popover位于最后一个子跨度中:

<span tariff-popover="views/popovers/c2g/airport.html" class="ng-isolate-scope">
    <span ng-transclude="">
        <span class="ng-scope">
           Flughafenpauschale
         </span>
     </span>
        &nbsp;
     <span popover-placement="right" popover-template="text" popover-trigger="mouseenter" class="fa fa-info-circle">
     </span>
</span>

当css选择器错误时,console.log会给我错误信息。有什么建议吗?

应该在电价的POPOPOR值周围加上引号。试试这个-

var popover = element(by.css('span[tariff-popover="views/popovers/c2g/airport.html"] > .fa.fa-info-circle'));
而且
.getInnerHtml()
将返回一个承诺。所以,您需要等待它返回一个值。以下是如何-

popover.getInnerHtml().then(function(val){
    console.log(val);
});
希望这有帮助

popover.getInnerHtml().then(function(val){
    console.log(val);
});