Test Overview
This test opens Microsoft Edge browser using Selenium WebDriver, navigates to a sample website, finds a button by its ID, clicks it, and verifies the page title changes as expected.
This test opens Microsoft Edge browser using Selenium WebDriver, navigates to a sample website, finds a button by its ID, clicks it, and verifies the page title changes as expected.
from selenium import webdriver from selenium.webdriver.edge.service import Service from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import unittest class TestEdgeConfig(unittest.TestCase): def setUp(self): service = Service(executable_path='msedgedriver') options = webdriver.EdgeOptions() options.use_chromium = True self.driver = webdriver.Edge(service=service, options=options) self.driver.maximize_window() def test_click_button_and_check_title(self): self.driver.get('https://example.com') wait = WebDriverWait(self.driver, 10) button = wait.until(EC.element_to_be_clickable((By.ID, 'start-button'))) button.click() wait.until(EC.title_is('Example Domain - Started')) self.assertEqual(self.driver.title, 'Example Domain - Started') def tearDown(self): self.driver.quit() if __name__ == '__main__': unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts - unittest framework initializes | No browser open yet | - | PASS |
| 2 | Edge WebDriver service and options configured, Edge browser opens maximized | Edge browser window is open and maximized | - | PASS |
| 3 | Browser navigates to 'https://example.com' | Page 'Example Domain' loaded in Edge browser | - | PASS |
| 4 | Waits until button with ID 'start-button' is clickable | Button is visible and enabled on the page | Element located and clickable | PASS |
| 5 | Clicks the 'start-button' | Button click triggers page title change | - | PASS |
| 6 | Waits until page title is 'Example Domain - Started' | Page title updated to 'Example Domain - Started' | Title matches expected value | PASS |
| 7 | Asserts that the page title equals 'Example Domain - Started' | Page title is 'Example Domain - Started' | assertEqual passes | PASS |
| 8 | Test ends, browser quits | Edge browser closed | - | PASS |