diff --git a/docs/api/puppeteer.page.evaluateonnewdocument.md b/docs/api/puppeteer.page.evaluateonnewdocument.md index 2a3c53bfcc2..66f94b2dd4d 100644 --- a/docs/api/puppeteer.page.evaluateonnewdocument.md +++ b/docs/api/puppeteer.page.evaluateonnewdocument.md @@ -43,13 +43,13 @@ An example of overriding the navigator.languages property before the page loads: // overwrite the `languages` property to use a custom getter Object.defineProperty(navigator, 'languages', { -get: function () { -return ['en-US', 'en', 'bn']; -}, + get: function () { + return ['en-US', 'en', 'bn']; + }, }); // In your puppeteer script, assuming the preload.js file is -in same folder of our script +// in same folder of our script. const preloadFile = fs.readFileSync('./preload.js', 'utf8'); await page.evaluateOnNewDocument(preloadFile); ``` diff --git a/src/common/Page.ts b/src/common/Page.ts index e97517d3544..0f078cc40ab 100644 --- a/src/common/Page.ts +++ b/src/common/Page.ts @@ -2784,13 +2784,13 @@ export class Page extends EventEmitter { * * // overwrite the `languages` property to use a custom getter * Object.defineProperty(navigator, 'languages', { - * get: function () { - * return ['en-US', 'en', 'bn']; - * }, + * get: function () { + * return ['en-US', 'en', 'bn']; + * }, * }); * * // In your puppeteer script, assuming the preload.js file is - * in same folder of our script + * // in same folder of our script. * const preloadFile = fs.readFileSync('./preload.js', 'utf8'); * await page.evaluateOnNewDocument(preloadFile); * ```