Created
January 12, 2026 09:36
-
-
Save borodicht/3b600725853c57e637ab270a6ead2025 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.demo.ui; | |
| import org.openqa.selenium.By; | |
| import org.openqa.selenium.WebDriver; | |
| public class LoginPage { | |
| private final WebDriver driver; | |
| public LoginPage(WebDriver driver) { | |
| this.driver = driver; | |
| } | |
| public void open() { | |
| driver.get("https://www.saucedemo.com/"); | |
| } | |
| public void login(String user, String pass) { | |
| driver.findElement(By.id("user-name")).sendKeys(user); | |
| driver.findElement(By.id("password")).sendKeys(pass); | |
| driver.findElement(By.id("login-button")).click(); | |
| } | |
| public boolean isErrorVisible() { | |
| return !driver.findElements(By.cssSelector("[data-test='error']")).isEmpty(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment