Angularjs 从下拉列表中选择值
我的代码是Angularjs 从下拉列表中选择值,angularjs,drop-down-menu,protractor,Angularjs,Drop Down Menu,Protractor,我的代码是 <md-option ng-repeat="item in countryList" ng-value="item" tabindex="0" class="ng-scope md-ink-ripple" role="option" aria-selected="false" id="select_option_778" value="[object Object]" style=""> <div class="md-text ng-binding">Afg
<md-option ng-repeat="item in countryList" ng-value="item" tabindex="0" class="ng-scope md-ink-ripple" role="option" aria-selected="false" id="select_option_778" value="[object Object]" style="">
<div class="md-text ng-binding">Afghanistan</div>
<div class="md-ripple-container" style=""></div>
</md-option>"
试试这个,这个应该有用
var countryList = element.all(by.repeater('item in countryList'));
for (i=0; i<=countryList.length(); i++)
{
countryList.get(i).click();
}
var countryList=element.all(by.repeater('countryList中的项目');
对于(i=0;i尝试对元素使用countryList.count()
。所有数组您可以通过以下方式进行尝试
var deferred = protractor.promise.defer();'
var selectAllElement = [];
var countryList = element.all(by.repeater('item in countryList'));
for (i=0; i<=countryList.length(); i++)
{
selectAllElement.push(countryList.get(i).click());
}
return protractor.promise.all(selectAllElement)
var deferred=dragrator.promise.deferred();'
var选择等位基因=[];
var countryList=element.all(by.repeater('countryList中的项目');
对于(i=0;iIs,到目前为止您是否尝试过任何操作?我尝试过cssSelector,repeater..对我不起作用..我尝试过的代码已更新到上面我尝试过repeater以及CSSContainingText.对我不起作用..感谢提供代码,但它对我不起作用..收到一个错误,说明“countryList.length()不是函数”无需在此处使用进行循环。嗨,Yash,谢谢你的回复,代码对我的案例不起作用。我收到的错误声明为失败:未知错误:元素…在点(112361)处不可单击。其他元素将收到单击:
var deferred = protractor.promise.defer();'
var selectAllElement = [];
var countryList = element.all(by.repeater('item in countryList'));
for (i=0; i<=countryList.length(); i++)
{
selectAllElement.push(countryList.get(i).click());
}
return protractor.promise.all(selectAllElement)