Test Overview
This test checks if the Python environment is correctly set up for Selenium testing. It verifies that the Selenium WebDriver can open a browser and navigate to a website.
This test checks if the Python environment is correctly set up for Selenium testing. It verifies that the Selenium WebDriver can open a browser and navigate to a website.
from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By import unittest class TestPythonEnvironmentSetup(unittest.TestCase): def setUp(self): service = Service() self.driver = webdriver.Chrome(service=service) def test_open_google(self): self.driver.get('https://www.google.com') title = self.driver.title self.assertIn('Google', title) def tearDown(self): self.driver.quit() if __name__ == '__main__': unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts and setUp method initializes Chrome WebDriver | Chrome browser window opens controlled by Selenium | - | PASS |
| 2 | Browser navigates to 'https://www.google.com' | Google homepage is loaded in the browser | - | PASS |
| 3 | Test checks if page title contains 'Google' | Page title is 'Google' | assertIn('Google', title) verifies title includes 'Google' | PASS |
| 4 | tearDown method closes the browser | Browser window closes | - | PASS |