Selenium + Python · Lesson 14 of 43
Module 14: Selenium Setup
Your task
Implement safe_quit_driver(driver):
Write it in the editor, then press Check answer (Ctrl + Enter).
quit() vs close()driver.close(): Closes only the current window/tab. The browser session stays alive.driver.quit(): Terminates the entire WebDriver session and cleans up the browser OS process.from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://targetqa.com")
driver.quit()In this lesson, we install Selenium using pip, launch Chrome, Firefox, and Edge, and understand the critical difference between close() and quit(). Let's dive in!
Part of the Selenium + Python course (Selenium with Python). Practice this concept live in the Selenium Online Compiler or explore our free automation practice form.
Orphaned browser processes remain active in memory, exhausting CPU and RAM on your test runners.
Ready? Solve the task in the editor
Use Check answer to mark it complete. Hints are there if you need them.
___