[英]Protractor cannot find angular on window
我正在尝试用量角器编写基本的e2e测试。 以下是我的测试。 我添加了console.log来查看是否可以访问URL,日志中的输出显示了对browser.getLocationAbsUrl()
的调用结果browser.getLocationAbsUrl()
是一个“待定”的Promise::105 {[[PromiseStatus]]: "pending"}
( Promise::105 {[[PromiseStatus]]: "pending"}
)。 我收到的Error while waiting for Protractor to sync with the page: "angular could not be found on the window"
是Error while waiting for Protractor to sync with the page: "angular could not be found on the window"
describe "routes", () ->
it "should automatically redirect to / when location hash/fragment is empty", () ->
browser.navigate 'index.html'
console.log browser.getLocationAbsUrl()
expect(browser.getLocationAbsUrl()).toBe '/'
我的配置文件很简单:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
baseUrl: 'http://localhost:8000',
capabilities: {
'browserName': 'chrome'
},
troubleshoot: true,
specs: ['app/spec/e2e/**/*.coffee']
}
您不能只在量角器/硒中使用console.log()
不同的东西,这就是所有的承诺。 您应该改为执行以下操作(很抱歉,我不擅长使用CoffeeScript):
browser.get('index.html');
browser.getLocationAbsUrl().then(function(url) {
console.log(url);
});
expect(browser.getLocationAbsUrl()).toBe('/');
尝试删除这些行:
seleniumAddress: 'http://localhost:4444/wd/hub',
baseUrl: 'http://localhost:8000',
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.