9. Simulating User Input & Gestures

Core Actions

// Form inputs:
await page.getByLabel("Email").fill("tester@targetqa.com");
await page.getByLabel("Subscribe").check();
await page.getByLabel("Country").selectOption("US");

// Keyboard & mouse:
await page.getByPlaceholder("Search").press("Enter");
await page.getByTestId("avatar").hover();

Task

  • Implement validateFormData:
  • 1. Accept data with email (string) and termsAccepted (boolean).
  • 2. Return true if email contains '@' and termsAccepted is true.
πŸ’‘Common doubts
Did you like the problem?
Lesson 9 of 18
JavaScript
Loading code editor…
Next