[英]Angular js, protractor
我是新的量角器和角度js,我正在测试一个小的待办事项列表框,这里是要检查的元素
<input class="toggle" type="checkbox">
<label>add</label>
我想知道两件事,一旦我们进入待办事项列表,我们如何使用回车键。 我试过用
input.sendKeys(value, protractor.Key.ENTER);
input.sendKeys(value);
input.sendKeys(protractor.Key.ENTER);
没有用。 当我们输入多个待办事项列表时,我应该使用什么定位器来检查多个复选框。输入无法正常工作我收到错误No element found using locator: By(css selector, input[type=checkbox])
谢谢你的回复。
以下是我的代码
it('should have placeholder text in the new todo input', function() {
var text = element(by.css('.new-todo')).getAttribute('placeholder');
expect(text).toEqual('What needs to be done?');
});
it('should add a new todo', function() {
var newTodo = element(by.css('.new-todo'));
newTodo.sendKeys('buy beer');
var firstTodo = element(by.css('.new-todo'));
var text = firstTodo.getAttribute('value');
expect(text).toEqual('buy beer');
var enter = browser.actions().sendKeys(protractor.Key.ENTER);
enter.perform();
});
it('validate the todo item list', function(){
var checkItem = element(by.css("input[type=checkbox]")).click();
expect(element(by.css("input[type=checkbox]")).isSelected()).toBeTruthy();
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.