What This Topic Covers

This topic focuses on the foundation of Selenium automation.

You will practice:

  • Launching Chrome, Firefox, and Edge browsers
  • Maximizing the browser
  • Deleting browser cookies
  • Opening URLs
  • Understanding the difference between close() and quit()
  • Using WebDriverManager

Starter Practice

Launch Browser → Open Google → Close Browser

Advertisement

Basic Practice Exercises (0–1 Year)

  1. Launch the Chrome browser and open Google.
  2. Launch the Firefox browser and open Google.
  3. Launch the Edge browser and open Google.
  4. Maximize the browser window after launch.
  5. Open a URL using the get() method.
  6. Open a URL using the navigate().to() method.
  7. Delete all cookies before opening a URL.
  8. Refresh the browser after page load.
  9. Navigate back and forward between pages.
  10. Close the browser using close().
  11. Close the browser using quit().
  12. Observe the difference between close() and quit().
  13. Launch browser → Open Google → Close browser.
  14. Launch browser → Open Google → Quit browser.
  15. Launch the browser without maximizing the window.
  16. Relaunch the browser after closing it.
  17. Open the browser and validate the page title.
  18. Open the browser and validate the current URL.
  19. Verify that the browser opened successfully.
  20. Open the browser and wait for the page to load completely.

Intermediate Practice Exercises (1–3 Years)

  1. Launch the browser using WebDriverManager.
  2. Remove the local driver path and execute using WebDriverManager.
  3. Launch Chrome and Firefox using the same test.
  4. Launch the browser using a parameter value.
  5. Launch the browser using a configuration file.
  6. Launch the browser using a TestNG XML parameter.
  7. Delete cookies before login.
  8. Handle browser notifications.
  9. Launch the browser in Incognito Mode.
  10. Launch the browser in Headless Mode.
  11. Launch the browser with a custom window size.
  12. Launch the browser with browser extensions disabled.
  13. Open a secure HTTPS website.
  14. Launch an internal application.
  15. Validate the browser type.
  16. Log the browser name.
  17. Capture the browser version.
  18. Execute multiple test cases.
  19. Close the browser after every test.
  20. Close the browser after suite execution.

Advanced Practice Exercises (3–5 Years)

  1. Launch the browser using a BaseTest class.
  2. Create a reusable browser setup method.
  3. Launch the browser across multiple test classes.
  4. Launch the browser only once for multiple tests.
  5. Execute browser tests in parallel.
  6. Launch multiple browsers simultaneously.
  7. Ensure one test does not close another browser.
  8. Implement browser management using ThreadLocal.
  9. Handle browser launch failures gracefully.
  10. Ensure the browser always quits even if a test fails.
  11. Launch the browser inside a CI environment.
  12. Execute browsers in Jenkins using Headless Mode.
  13. Pass the browser name from a Jenkins job.
  14. Launch browsers on Linux.
  15. Launch browsers on Windows.
  16. Handle browser crashes during execution.
  17. Restart the browser after a crash.
  18. Clean orphan browser instances.
  19. Optimize browser launch performance.
  20. Control the number of browser instances during execution.

Real-Time Defect and Failure Simulation Exercises

Practice troubleshooting by intentionally creating failures.

  1. Execute a test after a browser auto-update.
  2. Observe the driver mismatch failure.
  3. Fix the mismatch using WebDriverManager.
  4. Run a test without deleting cookies.
  5. Fix login issues by clearing cookies.
  6. Observe failures when quit() is not used.
  7. Monitor increased memory usage due to orphan browsers.
  8. Fix memory leaks using proper browser cleanup.
  9. Observe failures during parallel execution.
  10. Resolve parallel execution failures using ThreadLocal.

Interview-Level Practice Tasks

  1. Explain and demonstrate the browser setup flow.
  2. Modify an automation framework to support a new browser.
  3. Convert a single-browser framework into a cross-browser framework.
  4. Convert sequential execution into parallel execution.
  5. Debug a browser launch failure during an interview.
  6. Demonstrate the practical difference between close() and quit().

Must-Do Final Practice

  1. Launch browser → Maximize → Delete cookies → Open Google → Close browser.
  2. Launch browser → Open Google → Quit browser.
  3. Launch Chrome, Firefox, and Edge individually.
  4. Launch browsers using only WebDriverManager.
  5. Launch browsers without hardcoding values.
  6. Execute the same test across multiple browsers.
  7. Execute the same test in parallel browsers.
  8. Execute the test in Headless Mode.
  9. Run the test in a Jenkins-like environment.
  10. Ensure all browser instances are properly closed after execution.

Site-Mapped Practice

Basic Practice

  • Launch, open, and close browser → google.com
  • Firefox maximize, open, and quit → google.com
  • Edge launch and validation → example.com
  • get() and navigate().to()wikipedia.org
  • Delete cookies and reload → amazon.in
  • Refresh practice → demoqa.com
  • Browser back and forward → demoqa.com and demoqa.com/login
  • Close vs Quit using multiple Google tabs

Intermediate Practice

  • Cross-browser execution → saucedemo.com
  • WebDriverManager → example.com
  • Delete cookies before login → saucedemo.com
  • Browser from configuration → demoqa.com/login
  • Browser using TestNG XML → demoqa.com
  • Browser notificationsjustdial.com
  • Incognito mode → amazon.in
  • Headless execution → the-internet.herokuapp.com
  • Custom window size → selenium.dev
  • Browser name and version → example.com
  • Browser cleanup after each test → demoqa.com

Advanced Practice

  • BaseTest implementation → saucedemo.com
  • Browser reuse → demoqa.com
  • ThreadLocal execution → demoqa.com
  • Browser instance control → demoqa.com
  • Browser launch optimization → google.com
  • Memory cleanup validation → example.com

Failure Simulation

  • Driver mismatch → google.com
  • Cookie-based login issue → saucedemo.com
  • Browser not closing → demoqa.com
  • Parallel execution conflict → the-internet.herokuapp.com
  • Jenkins-style Headless execution → example.com

Final Capstone Exercise

Exercise 36 — Complete Browser Setup Flow

Practice on saucedemo.com.

Implement the complete browser initialization flow using:

  • Browser selection from Configuration or XML
  • WebDriverManager
  • Browser maximize
  • Delete cookies
  • Open application URL
  • Parallel execution
  • Proper browser cleanup using quit()

This exercise combines every browser setup concept into one complete framework-style implementation.


FAQs

What is the practical difference between close() and quit()?

close() closes only the current browser window, whereas quit() terminates the complete browser session and closes every associated browser window.


Why should I practice WebDriverManager?

WebDriverManager automatically manages browser driver versions and eliminates driver mismatch issues that occur after browser updates.


Why is ThreadLocal important?

ThreadLocal allows each parallel test to maintain its own WebDriver instance, preventing browser conflicts during parallel execution.


Which websites should I use for practice?

Recommended practice websites include:

  • google.com
  • example.com
  • wikipedia.org
  • demoqa.com
  • saucedemo.com
  • the-internet.herokuapp.com
  • amazon.in

Which exercise combines all browser setup concepts?

The Final Capstone Exercise combines configuration-driven browser launch, WebDriverManager, browser setup, parallel execution, and proper cleanup into one complete implementation.