Actions: click, fill, check and more
Every verb in a manual test case has a Playwright method: goto, click, fill, check, selectOption, hover, press and setInputFiles, and how Playwright acts like a real user.
Transcript
Actions are what a user does. Every verb in a manual test case has a Playwright method. Open a page with goto. Press a button with click.
Type into a field with fill. It clears the field first, then enters the text. Tick a checkbox with check, and choose from a dropdown with select option.
Move the mouse over something with hover. Press a key, like Enter or Tab, with press. Upload a file with set input files.
Put them together and you get a login. Fill the email, fill the password, tick remember me, and click Log in.
Playwright acts like a real user. Before a click, it waits until the element is visible, enabled, and not moving. Only then does it click. You do not need to add waits.
Remember: each manual verb has a method. Use fill to type, check to tick, and let Playwright wait for you.
More in this series
1:394Locators: find elements like a user
How Playwright finds an element: getByRole, getByLabel, getByText and getByTestId, why long CSS and XPath chains break, and the order to prefer.
1:256Assertions and auto-waiting
Write the expected result with expect, why fixed sleeps make tests slow and flaky, how Playwright waits automatically, and why web-first assertions retry.