Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 从下拉列表中选择值_Angularjs_Drop Down Menu_Protractor - Fatal编程技术网

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)