page.evaluate — Execute JavaScript
page.evaluate(fn) executes JavaScript in the browser context. You can return values from the browser to Node.js.
Task:
- Navigate to
https://testkru.com/Elements/TextFields - Use
page.evaluateto getdocument.title - Use
page.evaluateto count all input elements on the page (the count includes the hidden field and the duplicated first-name field)
Expected output:
Title: Text Fields Input count: 7
TestKru