我正在尝试使用我在网上找到的代码来运行量角器 在我写 protractor config.js 之后,网络驱动管理器关闭了。我安装了谷歌浏览器,但firefox是我的默认浏览器,我想知道它是否与问题相关
这是代码: 待办事项-spec.js
describe('angularjs homepage todo list', function () {
it('should add a todo', function () {
browser.get('https://angularjs.org');
element(by.model('todoList.todoText')).sendKeys('write first protractor test');
element(by.css('[value="add"]')).click();
var todoList = element.all(by.repeater('todo in todoList.todos'));
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write first protractor test');
// You wrote your first test, cross it off the list
todoList.get(2).element(by.css('input')).click();
var completedAmount = element.all(by.css('.done-true'));
expect(completedAmount.count()).toEqual(2);
});
});
config.js
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['todo-spec.js']
};
答案 0 :(得分:1)
您遇到此问题是因为您尝试使用命令protractor conf.js
在使用webdriver-manger start
启动selenium服务器的同一命令提示符窗口中运行您的量角器脚本。您应该使用不同的命令提示符/终端窗口来启动量角器测试。请按照以下步骤进行操作 -
webdriver-manger start
cd
命令protractor conf.js
命令启动自动化希望它有所帮助。