9. Executing Actions & User Input in Java

Core Playwright Java Actions

// Text inputs:
page.getByLabel("Email").fill("tester@targetqa.com");
page.getByLabel("Search").press("Enter");

// Checkboxes and Dropdowns:
page.getByLabel("Subscribe to updates").check();
page.getByLabel("Country").selectOption("Canada");

// Mouse:
page.getByTestId("menu-item").hover();
page.locator("#source").dragTo(page.locator("#target"));

Task

  • Implement isEmailValid:
  • 1. Accept String email.
  • 2. Return true if email contains "@" and ends with ".com".
πŸ’‘Common doubts
Did you like the problem?
Lesson 9 of 18
Java
Loading code editor…
Next