To log in and verify your login using @playwright/test, follow these steps:
Use page.goto()
to navigate to the desired webpage:
await page.goto('https://ray.run/');
Locate and click the login button with page.click()
:
await page.click('.login-button');
Fill out the necessary fields using page.fill()
:
await page.fill('#username', 'your_username');
await page.fill('#password', 'your_password');
Locate and click the submit/login button with page.click()
:
await page.click('.submit-button');
Wait for an element visible only when logged in, using expect(page).toHaveSelector()
:
await expect(page).toHaveSelector('.user-profile');
By following these steps and replacing placeholders like "your_username" and "your_password" with your actual credentials, you'll be able to log in and verify your login using Playwright.
If you still have questions, please ask a question and I will try to answer it.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].