feat(page): support Page.evaluateOnNewDocument for WebKit (#55)

This commit is contained in:
Yury Semikhatsky 2019-11-22 13:14:07 -08:00 committed by GitHub
parent e04910501b
commit ac01262c88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -344,6 +344,11 @@ export class Page extends EventEmitter {
return this._frameManager.mainFrame().evaluate(pageFunction, ...args);
}
async evaluateOnNewDocument(pageFunction: Function | string, ...args: Array<any>) {
const source = helper.evaluationString(pageFunction, ...args);
await this._session.send('Page.setBootstrapScript', { source });
}
async setCacheEnabled(enabled: boolean = true) {
await this._frameManager.networkManager().setCacheEnabled(enabled);
}

View File

@ -256,7 +256,7 @@ module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
});
});
describe.skip(WEBKIT)('Page.evaluateOnNewDocument', function() {
describe('Page.evaluateOnNewDocument', function() {
it('should evaluate before anything else on the page', async({page, server}) => {
await page.evaluateOnNewDocument(function(){
window.injected = 123;