feat(page): add an option to disable timeout for waitForFunction (#2252)

This patch adds support for `timeout: 0` to disable timeout for the following functions:
- `page.waitForFunction`
- `page.waitForXPath`
- `page.waitForSelector`
and their `frame` counterparts.

Fixes #2200
This commit is contained in:
Yaniv Efraim
2018-03-29 02:34:37 +03:00
committed by Andrey Lushnikov
parent 71a07bb50c
commit abb05e069d
3 changed files with 14 additions and 7 deletions

View File

@@ -790,7 +790,8 @@ class WaitTask {
});
// Since page navigation requires us to re-install the pageScript, we should track
// timeout on our end.
this._timeoutTimer = setTimeout(() => this.terminate(new Error(`waiting failed: timeout ${timeout}ms exceeded`)), timeout);
if (timeout)
this._timeoutTimer = setTimeout(() => this.terminate(new Error(`waiting failed: timeout ${timeout}ms exceeded`)), timeout);
this.rerun();
}