Test Overview
This test verifies that a Selenium Grid is correctly set up and configured by running a simple test on a remote node. It checks if the browser opens remotely, navigates to a page, and verifies the page title.
This test verifies that a Selenium Grid is correctly set up and configured by running a simple test on a remote node. It checks if the browser opens remotely, navigates to a page, and verifies the page title.
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.remote.webdriver import WebDriver import unittest class TestGridSetup(unittest.TestCase): def setUp(self): grid_url = "http://localhost:4444/wd/hub" capabilities = { "browserName": "chrome", "platformName": "ANY" } self.driver: WebDriver = webdriver.Remote(command_executor=grid_url, desired_capabilities=capabilities) def test_open_google(self): self.driver.get("https://www.google.com") title = self.driver.title self.assertEqual(title, "Google") def tearDown(self): self.driver.quit() if __name__ == '__main__': unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts and unittest framework initializes | Test runner ready to execute test methods | - | PASS |
| 2 | SetUp method creates Remote WebDriver connecting to Selenium Grid at http://localhost:4444/wd/hub with Chrome capabilities | Remote WebDriver session established on Grid node with Chrome browser | Remote WebDriver session is active | PASS |
| 3 | Driver navigates to https://www.google.com | Browser on remote node opens Google homepage | Page loaded with title 'Google' | PASS |
| 4 | Assertion checks if page title equals 'Google' | Page title retrieved from remote browser | title == 'Google' | PASS |
| 5 | tearDown method quits the remote WebDriver session | Remote browser closed and session ended | - | PASS |