0
0
Selenium Pythontesting~10 mins

Edge configuration in Selenium Python - Test Execution Trace

Choose your learning style9 modes available
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.

Test Code - unittest
Selenium Python
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()
Execution Trace - 8 Steps
StepActionSystem StateAssertionResult
1Test starts - unittest framework initializesNo browser open yet-PASS
2Edge WebDriver service and options configured, Edge browser opens maximizedEdge browser window is open and maximized-PASS
3Browser navigates to 'https://example.com'Page 'Example Domain' loaded in Edge browser-PASS
4Waits until button with ID 'start-button' is clickableButton is visible and enabled on the pageElement located and clickablePASS
5Clicks the 'start-button'Button click triggers page title change-PASS
6Waits until page title is 'Example Domain - Started'Page title updated to 'Example Domain - Started'Title matches expected valuePASS
7Asserts that the page title equals 'Example Domain - Started'Page title is 'Example Domain - Started'assertEqual passesPASS
8Test ends, browser quitsEdge browser closed-PASS
Failure Scenario
Failing Condition: Button with ID 'start-button' is not found or not clickable within 10 seconds
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test verify after clicking the button?
AThe button becomes disabled
BThe page title changes to 'Example Domain - Started'
CA new tab opens
DThe URL changes to a new domain
Key Result
Always configure the Edge WebDriver with proper options and use explicit waits to handle dynamic page elements reliably.