puppeteer-sharp icon indicating copy to clipboard operation
puppeteer-sharp copied to clipboard

Improve EvaluateExpressionOnNewDocumentAsync(String)

Open WhatFreshHellIsThis opened this issue 2 years ago • 1 comments

Explain how would you like this document to be impoved. Source URL: https://github.com/kblok/puppeteer-sharp/blob/master/lib/PuppeteerSharp/Page.cs/#L585

I would like to see the example of how to set the language as alluded to in the docs but not shown (instead it shows how to set a property on the Window:

Examples

An example of overriding the navigator.languages property before the page loads:

await page.EvaluateExpressionOnNewDocumentAsync("window.__example = true;");

WhatFreshHellIsThis avatar Nov 05 '21 18:11 WhatFreshHellIsThis

Can be updated based on puppeteer doc.

  • https://github.com/puppeteer/puppeteer/blob/066f440ba7bdc9aca9423d7205adf36f2858bd78/src/common/Page.ts#L2717
  • https://github.com/puppeteer/puppeteer/blob/066f440ba7bdc9aca9423d7205adf36f2858bd78/docs/api/puppeteer.page.evaluateonnewdocument.md#example

amaitland avatar Jul 03 '22 20:07 amaitland