Test Overview
This test opens a webpage, finds a button, performs a double click on it, and verifies that the button's text changes as expected after the double click.
This test opens a webpage, finds a button, performs a double click on it, and verifies that the button's text changes as expected after the double click.
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import unittest class TestDoubleClick(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome() self.driver.get('https://example.com/double-click-test') self.wait = WebDriverWait(self.driver, 10) def test_double_click_changes_text(self): driver = self.driver wait = self.wait button = wait.until(EC.presence_of_element_located((By.ID, 'double-click-btn'))) actions = ActionChains(driver) actions.double_click(button).perform() changed_text = wait.until(EC.text_to_be_present_in_element((By.ID, 'double-click-btn'), 'Clicked!')) self.assertTrue(changed_text, 'Button text did not change after double click') def tearDown(self): self.driver.quit() if __name__ == '__main__': unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts and Chrome browser opens | Browser window is open, ready to navigate | - | PASS |
| 2 | Navigates to 'https://example.com/double-click-test' | Page loads with a button having id 'double-click-btn' visible | Waits until button with id 'double-click-btn' is present | PASS |
| 3 | Finds the button element by ID 'double-click-btn' | Button element is located and ready for interaction | - | PASS |
| 4 | Performs a double click action on the button | Button receives double click event | - | PASS |
| 5 | Waits until the button's text changes to 'Clicked!' | Button text updates to 'Clicked!' after double click | Verifies button text contains 'Clicked!' | PASS |
| 6 | Test ends and browser closes | Browser window is closed | - | PASS |