Skip to content
CodeKruPro

page.evaluate - Execute JavaScript

58/70

page.evaluate — Execute JavaScript

page.evaluate(fn) executes JavaScript in the browser context. You can return values from the browser to Node.js.

Task:

  1. Navigate to https://testkru.com/Elements/TextFields
  2. Use page.evaluate to get document.title
  3. Use page.evaluate to 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