HTML代码
<li name="choice" ng-repeat="choice in candidateStatus" ng-if="choice!=member.candidate_status.status" ng-click="setStatus(choice, member)" class="ng-binding ng-scope">Shortlisted</li>
它给出了错误
ElementNotVisibleError: element not visible
我尝试使用此代码向下滚动页面,但无法正常工作。
browser.executeScript('window.scrollTo(0,250);');
请帮帮我
尝试通过获取元素的位置来滚动页面,然后等到滚动发生后再使用executeScript()
函数返回的诺言单击元素。这样做的方法-
var ele = element(by.repeater('choice in candidateStatus'));
ele.getLocation()
.then(function(loc){
browser.executeScript('window.scrollTo(0,'+loc.y+');')
.then(function(){
ele.click();
});
});
如果有多个带有ng-repeat
tag的列表元素,那么您可能应该在单击特定列表元素之前将其获取。
希望这可以帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句