← Back to libraryQuestion 156 of 273
🧪SeleniumIntermediate

Test Execution Flow in Selenium

📖 Detailed Explanation:

A typical test execution flow: 1. Setup Phase (Initialize WebDriver, open browser, navigate to URL), 2. Action Phase (Interact with elements—click, type, select), 3. Validation Phase (Assert actual vs expected results), 4. Cleanup Phase (Take screenshot if failed, close browser). This flow is implemented using test framework annotations like @Before, @Test, @After (JUnit) or @BeforeMethod, @Test, @AfterMethod (TestNG).

🌍 Real-World Example:

Setup: Get ready. Action: Do the thing. Validation: Check if it worked. Cleanup: Clean up and go home.

🎯 Scenario-Based Interview Question:

Describe the lifecycle of a single Selenium test case in your current framework.