17. Hardware Actions: Clicks, Typing, Checkboxes & Hover

Core Actions in Python

page.get_by_label("Username").fill("sdet_pro")
page.get_by_label("Username").clear()

page.get_by_label("Subscribe").check()
page.locator("#country").select_option("Canada")

page.get_by_role("button", name="Menu").hover()
page.locator("#source").drag_to(page.locator("#target"))

Task

  • Implement fill_credentials_and_submit(page, email, password):
  • 1. page.get_by_label("Email").fill(email)
  • 2. page.get_by_label("Password").fill(password)
  • 3. page.get_by_role("button", name="Sign In").click()
πŸ’‘Common doubts
Did you like the problem?
Lesson 17 of 37
Python
Loading code editor…
Next