diff --git a/lib/Page.js b/lib/Page.js index 31fa78d6d31..eb06dfa08dc 100644 --- a/lib/Page.js +++ b/lib/Page.js @@ -248,7 +248,7 @@ class Page extends EventEmitter { * @return {!Promise} */ async setContent(html) { - this.evaluate(() => { + this.evaluate((html) => { document.open(); document.write(html); document.close(); diff --git a/test/test.js b/test/test.js index 8017e1f55ba..a1497653d30 100644 --- a/test/test.js +++ b/test/test.js @@ -497,6 +497,13 @@ describe('Puppeteer', function() { expect(request.headers['foo']).toBe('bar'); })); }); + describe('Page.setContent', function() { + it('should work', SX(async function() { + await page.setContent('
hello
'); + let result = await page.evaluate(() => document.body.innerHTML); + expect(result).toBe('
hello
'); + })); + }); describe('Network Events', function() { it('Page.Events.Request', SX(async function() { let requests = [];