0
嘗試運行示例spec,並在腳本中發生如下小改動,並且出現錯誤。它看起來像在執行斷言之前,如果阻止它將URL更改爲谷歌,然後檢查谷歌頁面上的斷言。async/await - 與示例規範的問題
import {browser, element, by, By, $, $$, ExpectedConditions} from 'protractor';
describe('async function', function() {
it('should wait on async function in conditional', async function(): Promise<any> {
await browser.get('http://www.angularjs.org');
const todoList = element.all(by.repeater('todo in todoList.todos'));
if ((await todoList.count()) > 1) {
expect((await todoList.get(1).getText())).toEqual('build an AngularJS app');
}
await browser.get('http://www.google.com');
});
});
錯誤:
[10:58:03] E/protractor - Could not find Angular on page http://www.google.com/ : retries looking for angular exceeded
async function
✗ should wait on async function in conditional
- Failed: Angular could not be found on the page http://www.google.com/.If this is not an Angular application, you may need to turn off waiting for Angular.
Please see
https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular-on-page-load
Please see
https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular-on-page-load
at executeAsyncScript_.then (/node_modules/protractor/lib/browser.ts:936:29)
你確定你的意思是'goo凝膠「而不是」谷歌「? 「googel.com」在他們的網站上運行Angular的可能性不大(如果它存在的話)。 –
對不起,這是一個錯字。但錯誤是一樣的。 – Karthi