Overview
TheLoginPage class encapsulates the login page functionality for the SauceDemo application. It provides methods to navigate to the login page and perform authentication.
Initialization
Playwright Page object for browser interaction
Locators
The LoginPage class defines the following locators:| Locator | Selector | Description |
|---|---|---|
username_input | [data-test="username"] | Username input field |
password_input | [data-test="password"] | Password input field |
login_button | [data-test="login-button"] | Login submit button |
Methods
navigate()
Navigates to the SauceDemo login page.None
login(username, password)
Performs login by filling in credentials and clicking the login button.The username for authentication
The password for authentication
None
Usage Examples
Basic Login Flow
Login with Environment Variables
Login with Test Data
Source Code
Location:/home/daytona/workspace/source/pages/login.py:4