Playwright · Method
page.evaluate
page.evaluate() runs JavaScript in the browser page and returns its result to the Playwright test. Pass test values explicitly, and use init scripts for code that must run before page loading.
Last updated
Syntax
await page.evaluate(pageFunction, arg)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
page.evaluate_handle()page.add_init_script()browserContext.add_init_script()JSHandle.evaluate()