如何在量角器e2e测试中获取此元素的模型selected-model
?
<div id="abc"
ng-dropdown-multiselect=""
options="dropdown.result.options"
selected-model="dropdown.result.model"
extra-settings="dropdown.result.settings"
translation-texts="dropdown.result.texts">
</div>
答案 0 :(得分:2)
获取模型名称 - 例如,使用[('a', '111.222.222.111', '22.222.111.111')]
[('b', '22.111.22.222', '153.33.233.111')]
[('c', '222.30.233.121', '44.233.111.111')]
[('d', '22.111.22.222', '153.33.233.111')]
定位器找到元素,然后调用by.id()
:
getAttribute()
或者,如果您想获取模型值本身,可以evaluate()
:
var elm = element(by.id('abc'));
elm.getAttribute("selected-model").then(function (model) {
console.log(model);
});