由网友(爷,独霸青楼)分享简介:我试图让使用量角器一个select元素的期权价值。不过,我无法找到的选项元素。I am trying to get the option value of a select element using Protractor. However, I'm not able to find the option eleme...
我试图让使用量角器一个select元素的期权价值。不过,我无法找到的选项元素。
I am trying to get the option value of a select element using Protractor. However, I'm not able to find the option element.
HTML
<select ng-options="opions.c as options.n for option in options" ng-model="model">
<option value="0">Option 1</option>
<option value="1">Option 2</option>
</select>
规格文件
describe('testing select option', function() {
it('', function() {
ptor = protractor.getInstance();
//This will not get the option required
ptor.findElement(protractor.By.binding('model'));
});
});
我似乎无法找到一个方法来抓住期权价值,因为我还没有找到,我可以使用,不给和异常或错误信息的功能。
I cannot seem to find a way to grab the option value as I haven't found a function that I can use that doesn't give and exception or error message.
有谁知道如何解决这个问题呢?
Does anyone know how to resolve this issue?
推荐答案
再次确定我现在已经能弄清楚如何抓住用量角器选项元素。
ok again I have now been able to figure out how to grab the option element with protractor.
这个例子code以下显示了如何做到这一点。
the example code below shows how to accomplish this.
ptor.findElement(protractor.By.css('select option:nth-child(value of the option you require IE: the number)')).click();
相关推荐
最新文章