Angular 找不到元素-量角器的可测试性
config.js:Angular 找不到元素-量角器的可测试性,angular,protractor,ui-testing,e2e-testing,Angular,Protractor,Ui Testing,E2e Testing,config.js: exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['todo-spec.js', 'landing-page-spec.js'] }; useAllAngular2AppRoots: true 登录页面:page.spec.js: describe('homepage', function() { it('navigates to the find page
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['todo-spec.js', 'landing-page-spec.js']
};
useAllAngular2AppRoots: true
登录页面:page.spec.js:
describe('homepage', function() {
it('navigates to the find page when clicking "try now"', function() {
browser.get('http://localhost:3002');
element(by.css('button.x-button')).click();
var x = element(by.css('h2:first-of-type'));
expect(x.getText()).toEqual("hello world");
});
});
当我运行配置文件时,它通过todo-spec.js,然后开始执行landing-page.spec.js,在其中加载我的web应用程序,然后失败,出现以下错误:
Failures: 1) VEPO homepage navigates to the find page when clicking "try now" Message:
Failed: Error while waiting for Protractor to sync with the page: "Could not find testability for element." Stack:
Error: Error while waiting for Protractor to sync with the page: "Could not find testability for element."
at /usr/local/lib/node_modules/protractor/built/browser.js:269:23
at ManagedPromise.invokeCallback_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1379:14)
at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14)
at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2775:27
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7
at process._tickCallback (node.js:382:9)Error
at ElementArrayFinder.applyAction_ (/usr/local/lib/node_modules/protractor/built/element.js:397:27)
at ElementArrayFinder._this.(anonymous function) [as click] (/usr/local/lib/node_modules/protractor/built/element.js:100:30)
at ElementFinder.(anonymous function) [as click] (/usr/local/lib/node_modules/protractor/built/element.js:728:22)
at Object.<anonymous> (/Users/Ben/Development/vepo/app/test/landing-page-spec.js:4:43)
at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:94:23
at new ManagedPromise (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1082:7)
at controlFlowExecute (/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:80:18)
at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14)
at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2820:25
From: Task: Run it("navigates to the find page when clicking "try now"") in control flow
at Object.<anonymous> (/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:79:14)
From asynchronous test:
Error
at Suite.<anonymous> (/Users/Ben/Development/vepo/app/test/landing-page-spec.js:2:3)
at Object.<anonymous> (/Users/Ben/Development/vepo/app/test/landing-page-spec.js:1:1)
at Module._compile (module.js:398:26)
at Object.Module._extensions..js (module.js:405:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
2 specs, 1 failure Finished in 9.143 seconds [21:11:17] I/launcher - 0 instance(s) of WebDriver still running [21:11:17] I/launcher - chrome
#01 failed 1 test(s) [21:11:17] I/launcher - overall: 1 failed spec(s) [21:11:17] E/launcher - Process exited with error code 1
失败:1)VEPO主页在单击“立即试用”消息时导航到查找页面:
失败:等待量角器与页面同步时出错:“找不到元素的可测试性。”堆栈:
错误:等待量角器与页面同步时出错:“找不到元素的可测试性。”
at/usr/local/lib/node_modules/dragrator/build/browser.js:269:23
在ManagedPromise.invokeCallback上(/usr/local/lib/node\u modules/dragrator/node\u modules/selenium webdriver/lib/promise.js:1379:14)
在TaskQueue.execute处(/usr/local/lib/node_modules/dragrator/node_modules/selenium webdriver/lib/promise.js:2913:14)
在TaskQueue.executeNext(/usr/local/lib/node_modules/dragrator/node_modules/selenium webdriver/lib/promise.js:2896:21)
at/usr/local/lib/node_modules/dragrator/node_modules/selenium webdriver/lib/promise.js:2775:27
at/usr/local/lib/node_modules/dragrator/node_modules/selenium webdriver/lib/promise.js:639:7
在进程中。回调(node.js:382:9)错误
位于ElementArrayFinder.applyAction(/usr/local/lib/node\u modules/dragrator/build/element.js:397:27)
在ElementArrayFinder._this.(匿名函数)[as click](/usr/local/lib/node_modules/dragrator/build/element.js:100:30)
在ElementFinder(匿名函数)[as click](/usr/local/lib/node\u modules/dragrator/build/element.js:728:22)
反对。(/Users/Ben/Development/vepo/app/test/landing-page-spec.js:4:43)
at/usr/local/lib/node_modules/dragrator/node_modules/jasminewd2/index.js:94:23
在新的ManagedPromise(/usr/local/lib/node_modules/dragrator/node_modules/selenium webdriver/lib/promise.js:1082:7)
在controlFlowExecute(/usr/local/lib/node_modules/dragrator/node_modules/jasminewd2/index.js:80:18)
在TaskQueue.execute处(/usr/local/lib/node_modules/dragrator/node_modules/selenium webdriver/lib/promise.js:2913:14)
在TaskQueue.executeNext(/usr/local/lib/node_modules/dragrator/node_modules/selenium webdriver/lib/promise.js:2896:21)
在/usr/local/lib/node_modules/dragrator/node_modules/selenium webdriver/lib/promise.js:2820:25
From:Task:在控制流中运行它(“单击“立即重试”时导航到查找页面”)
反对。(/usr/local/lib/node_modules/dragrator/node_modules/jasminewd2/index.js:79:14)
从异步测试:
错误
在套房。(/Users/Ben/Development/vepo/app/test/landing-page-spec.js:2:3)
反对。(/Users/Ben/Development/vepo/app/test/landing-page-spec.js:1:1)
在模块处编译(Module.js:398:26)
在Object.Module.\u extensions..js(Module.js:405:10)
在Module.load(Module.js:344:32)
在Function.Module.\u加载(Module.js:301:12)
2个规格,1个故障在9.143秒内完成[21:11:17]I/launcher-0个WebDriver实例仍在运行[21:11:17]I/launcher-chrome
#01未通过1次测试[21:11:17]I/启动器-总体:1次未通过规范[21:11:17]E/启动器-进程退出,错误代码为1
错误的原因是什么 您的页面是在Angular 2中构建的吗?在这种情况下,请将以下内容添加到config.js中:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['todo-spec.js', 'landing-page-spec.js']
};
useAllAngular2AppRoots: true
浏览器现在将等待加载所有angular2。添加使用angular2方法:true,
在progrator.conf.js中 这对我很有效