mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
feat(webkit): add page back/forward commands (#144)
This commit is contained in:
parent
b5af3cac11
commit
25af050bd4
@ -267,6 +267,24 @@ export class Page extends EventEmitter {
|
||||
return response;
|
||||
}
|
||||
|
||||
async goBack(): Promise<network.Response | null> {
|
||||
return await this._go('Page.goBack');
|
||||
}
|
||||
|
||||
async goForward(): Promise<network.Response | null> {
|
||||
return await this._go('Page.goForward');
|
||||
}
|
||||
|
||||
async _go<T extends keyof Protocol.CommandParameters>(command: T): Promise<network.Response | null> {
|
||||
const [response, error] = await Promise.all([
|
||||
this.waitForNavigation(),
|
||||
this._session.send(command).then(() => null).catch(e => e),
|
||||
]);
|
||||
if (error)
|
||||
return null;
|
||||
return response;
|
||||
}
|
||||
|
||||
async waitForNavigation(): Promise<network.Response | null> {
|
||||
return await this._frameManager.mainFrame().waitForNavigation();
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ module.exports.addTests = function({testRunner, expect, playwright, FFOX, CHROME
|
||||
response = await page.goForward();
|
||||
expect(response).toBe(null);
|
||||
});
|
||||
it.skip(WEBKIT)('should work with HistoryAPI', async({page, server}) => {
|
||||
it('should work with HistoryAPI', async({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.evaluate(() => {
|
||||
history.pushState({}, '', '/first.html');
|
||||
|
Loading…
Reference in New Issue
Block a user