angularjs - 如何从下拉数组中的元素数组中选择一个值
问题描述
我正在尝试从元素数组中选择一个下拉值(公司管理)。但是,以错误结束
失败:element.all(...).get(...).click(...).element.all 不是函数
谁能帮我解决这个问题。
量角器/JasmineJs 片段:
element.all(by.className('btn btn-default dropdown-toggle')).get(0).click().element
.all(by.repeater('lookupData in lookupDataValues | filter: filteredValue'))
.get(0).click();
代码片段:
<button ng-disabled="customDisabled()" class="btn btn-default dropdown-toggle" type="button" style="min-width: 0px;padding: 3px;border-radius: 0px;"
data-toggle="dropdown" ng-click="displayDropDownForSelectingValues()">
<span style="background:white;border-right: white; font-size:12px;" id="statusinput" class="ng-binding"></span>
<div class="caret_container" style="display:inline-block;">
<span class="caret" style="margin-top: 0px;"></span>
</div>
</button>
<ul class="dropdown-menu dropdown-menu-right dropdown-scroll" ng-click="preventBlur($event)" role="menu" ng-show="showList"
style="">
<li class="fa fa-cog fa-spin fa-3x fa-fw" ng-hide="hideLoading" style="margin-left: 50%; font-size: 18px; display: none;"></li>
<li class="searchInputBox" ng-show="hideLoading && showList" style="padding: 0px 2%;">
<input type="text" ng-keyup="updateFilter()" id="managementTypeIdSearch" role="menuitem" class="searchInput" style="width:100%;">
<span class="fa fa-search"></span>
</li>
<!-- ngRepeat: lookupData in lookupDataValues | filter: filteredValue -->
<li ng-repeat="lookupData in lookupDataValues | filter: filteredValue" class="ng-scope">
<a ng-href="" role="menuitem" ng-click="updateValue(lookupData.key)" style="font-size:12px;" class="ng-binding">Company Managed</a>
</li>
<li ng-repeat="lookupData in lookupDataValues | filter: filteredValue" class="ng-scope">
<a ng-href="" role="menuitem" ng-click="updateValue(lookupData.key)" style="font-size:12px;" class="ng-binding">Customer Managed</a>
</li>
</ul>
<button ng-disabled="customDisabled()" class="btn btn-default dropdown-toggle" type="button" style="min-width: 0px;padding: 3px;border-radius: 0px;"
data-toggle="dropdown" ng-click="displayDropDownForSelectingValues()">
<span style="background:white;border-right: white; font-size:12px;" id="statusinput" class="ng-binding"></span>
<div class="caret_container" style="display:inline-block;">
<span class="caret" style="margin-top: 0px;"></span>
</div>
</button>
<ul class="dropdown-menu dropdown-menu-right dropdown-scroll" ng-click="preventBlur($event)" role="menu" ng-show="showList"
style="">
<li class="fa fa-cog fa-spin fa-3x fa-fw" ng-hide="hideLoading" style="margin-left: 50%; font-size: 18px; display: none;"></li>
<li class="searchInputBox" ng-show="hideLoading && showList" style="padding: 0px 2%;">
<input type="text" ng-keyup="updateFilter()" id="resiliencyIdSearch" role="menuitem" class="searchInput" style="width:100%;">
<span class="fa fa-search"></span>
</li>
<!-- ngRepeat: lookupData in lookupDataValues | filter: filteredValue -->
<li ng-repeat="lookupData in lookupDataValues | filter: filteredValue" class="ng-scope">
<a ng-href="" role="menuitem" ng-click="updateValue(lookupData.key)" style="font-size:12px;" class="ng-binding">--Please Select--</a>
</li>
<li ng-repeat="lookupData in lookupDataValues | filter: filteredValue" class="ng-scope">
<a ng-href="" role="menuitem" ng-click="updateValue(lookupData.key)" style="font-size:12px;" class="ng-binding">Backup</a>
</li>
<li ng-repeat="lookupData in lookupDataValues | filter: filteredValue" class="ng-scope">
<a ng-href="" role="menuitem" ng-click="updateValue(lookupData.key)" style="font-size:12px;" class="ng-binding">Secure</a>
</li>
<li ng-repeat="lookupData in lookupDataValues | filter: filteredValue" class="ng-scope">
<a ng-href="" role="menuitem" ng-click="updateValue(lookupData.key)" style="font-size:12px;" class="ng-binding">Secure+</a>
</li>
<li ng-repeat="lookupData in lookupDataValues | filter: filteredValue" class="ng-scope">
<a ng-href="" role="menuitem" ng-click="updateValue(lookupData.key)" style="font-size:12px;" class="ng-binding">Standard</a>
</li>
</ul>
错误:
Message: Failed: element.all(...).get(...).click(...).element.all is not a function Stack: TypeError: element.all(...).get(...).click(...).element.all is not a function
解决方案
用分号 (;) 分隔两个element.all
调用。
element.all(by.className('btn btn-default dropdown-toggle')).get(0).click();
element.all(by.repeater('lookupData in lookupDataValues | filter: filteredValue'))
.get(0).click();
推荐阅读
- spring - RequestParam 的 Spring 验证错误
- authentication - 我们如何在 google puppeteer 的 headless chrome 中传递身份验证令牌?
- php - 如何在 eloquent 中更改 groupBy 后的键值?
- mule - 当 mule 流通过 HTTP 调用另一个流时收到 404 错误响应,即使服务器已启动
- javascript - 使用 CSS 和 javascript 制作具有不同样式的单词的段落的正确方法是什么
- java - Spring Data JPA BigList 插入
- bash - 用另一个文件头替换文件头
- javascript - 基本偶数或奇数问题。完成下面的isLastEvenOdd函数
- python - Firestore 云侦听器,不适用于集合内的集合
- r - 根据 PCA 中的名称对行进行子集化