Test Overview
This test opens a browser using WebDriverManager to automatically manage the driver. It navigates to a website and verifies the page title to confirm the page loaded correctly.
This test opens a browser using WebDriverManager to automatically manage the driver. It navigates to a website and verifies the page title to confirm the page loaded correctly.
import io.github.bonigarcia.wdm.WebDriverManager; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; public class WebDriverManagerTest { private WebDriver driver; @BeforeEach public void setup() { WebDriverManager.chromedriver().setup(); driver = new ChromeDriver(); } @Test public void testPageTitle() { driver.get("https://example.com"); String title = driver.getTitle(); assertEquals("Example Domain", title); } @AfterEach public void teardown() { if (driver != null) { driver.quit(); } } }
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | WebDriverManager sets up ChromeDriver automatically | ChromeDriver binary is downloaded and configured for use | - | PASS |
| 2 | Test creates a new ChromeDriver instance | Chrome browser window opens | - | PASS |
| 3 | Browser navigates to https://example.com | Example Domain page is loaded in the browser | - | PASS |
| 4 | Test retrieves the page title | Page title is "Example Domain" | Verify page title equals "Example Domain" | PASS |
| 5 | Test closes the browser | Browser window is closed | - | PASS |