Lesson 4: Handle Inputs and Buttons

Interacting with Forms

Form filling is the bread and butter of UI automation.

Input Fields

javascript

await page.getByLabel('User Name').fill('vishvas');

await page.getByPlaceholder('Password').pressSequentially('12345', { delay: 100 });

Buttons & Checkboxes

javascript

await page.getByRole('button', { name: 'Submit' }).dblclick();

await page.getByLabel('I agree to the terms').check();

    CareerRaah - AI Learning Platform for Professionals