我正在使用量角器茉莉花在我的棱角部位进行e2e测试。在使用异步函数并等待其余代码时,返回的承诺在Jasmine-protractor中给出了错误。
我什至包括:SELENIUM_PROMISE_MANAGER: false,
it('Sub-folder: Manage permission, Edit Folder name, Create Template, View Template', async ()=> {
await obj.getURL();
obj.TealoginUname.sendKeys(data.uname);
obj.TealoginPass.sendKeys(data.pass);
await obj.TealoginButton.click();
await browser.sleep(2000);
})
控制台错误:
Error: Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See http://git.io/v4gXM for details"
在Eclipse中,在写入async
/ await
的那些行上显示错误。
我正在将Page对象模型用于动态元素。
var obj= require("./somefile.js");
somefile.js:-
function globalVariables()
{
this.TealoginUname= element(by.model("vm.login.userid"));
this.TealoginPass= element(by.model("vm.login.password"));
this.TealoginButton= element(by.xpath("//*[@id='login-form']/form[1]/button"));
}
答案 0 :(得分:0)
不导入定位符,将其添加到测试文件中
const TealoginUname= element(by.model("vm.login.userid"));
const TealoginPass= element(by.model("vm.login.password"));
const TealoginButton= element(by.xpath("//*[@id='login-form']/form[1]/button"));
尝试以下一个
it('Sub-folder: Manage permission, Edit Folder name, Create Template, View Template', async ()=> {
await broswer.get('add your url here');
await browser.waitForAngularEnabled(true); // To make protractor wait for all the http request to get compelted
await TealoginUname.sendKeys(data.uname);
await TealoginPass.sendKeys(data.pass);
await TealoginButton.click();
await browser.sleep(2000);
})