mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
Introduce Page.waitForNavigation (#94)
This patch introduces Page.waitForNavigation which allows to wait for render-initiated navigation. This patch also does a nice refactoring, replacing Navigator with NavigatorWatcher which is not a part of a page state. References #89
This commit is contained in:
committed by
Andrey Lushnikov
parent
bef9982687
commit
98c3894c84
11
test/test.js
11
test/test.js
@@ -427,6 +427,17 @@ describe('Puppeteer', function() {
|
||||
}));
|
||||
});
|
||||
|
||||
describe('Page.waitForNavigation', function() {
|
||||
it('should work', SX(async function() {
|
||||
await page.navigate(EMPTY_PAGE);
|
||||
const result = page.waitForNavigation();
|
||||
page.evaluate(url => window.location.href = url, PREFIX + '/grid.html');
|
||||
const response = await result;
|
||||
expect(response.ok).toBe(true);
|
||||
expect(response.url).toContain('grid.html');
|
||||
}));
|
||||
});
|
||||
|
||||
describe('Page.setInPageCallback', function() {
|
||||
it('should work', SX(async function() {
|
||||
await page.setInPageCallback('callController', function(a, b) {
|
||||
|
||||
Reference in New Issue
Block a user