Test Overview
This test uses markers to categorize tests in Selenium with Python. It runs a simple test that opens a webpage and checks the page title. The marker helps group this test for easy selection later.
This test uses markers to categorize tests in Selenium with Python. It runs a simple test that opens a webpage and checks the page title. The marker helps group this test for easy selection later.
import pytest from selenium import webdriver from selenium.webdriver.common.by import By @pytest.mark.smoke def test_open_google(): driver = webdriver.Chrome() driver.get('https://www.google.com') assert 'Google' in driver.title driver.quit()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts with pytest runner recognizing the @pytest.mark.smoke marker | Test framework is ready to run tests marked as 'smoke' | - | PASS |
| 2 | Selenium WebDriver Chrome instance is created | Browser window opens, ready to navigate | - | PASS |
| 3 | Browser navigates to 'https://www.google.com' | Google homepage is loaded in the browser | - | PASS |
| 4 | Test checks if 'Google' is in the page title | Page title contains 'Google' | assert 'Google' in driver.title | PASS |
| 5 | Browser is closed with driver.quit() | Browser window is closed | - | PASS |