0
0
Selenium Pythontesting~10 mins

Closing browser (close vs quit) in Selenium Python - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to close the current browser window.

Selenium Python
driver.[1]()
Drag options to blanks, or click blank then click option'
Aclose
Bstop
Cexit
Dquit
Attempts:
3 left
💡 Hint
Common Mistakes
Using quit() instead of close() when only one window should be closed.
Using exit() or stop(), which are not Selenium methods.
2fill in blank
medium

Complete the code to close all browser windows and end the WebDriver session.

Selenium Python
driver.[1]()
Drag options to blanks, or click blank then click option'
Ashutdown
Bclose
Cquit
Dexit
Attempts:
3 left
💡 Hint
Common Mistakes
Using close() when intending to end the whole session.
Using shutdown() or exit(), which are not valid Selenium methods.
3fill in blank
hard

Fix the error in the code to properly close the browser session.

Selenium Python
driver.[1]()  # closes all windows and ends session
Drag options to blanks, or click blank then click option'
Aclose
Bstop
Cexit
Dquit
Attempts:
3 left
💡 Hint
Common Mistakes
Using close() when quit() is needed.
Using stop() or exit(), which are invalid.
4fill in blank
hard

Fill both blanks to close the current window and then end the session.

Selenium Python
driver.[1]()
driver.[2]()
Drag options to blanks, or click blank then click option'
Aclose
Bquit
Cexit
Dstop
Attempts:
3 left
💡 Hint
Common Mistakes
Reversing the order of close() and quit().
Using exit() or stop(), which are not Selenium methods.
5fill in blank
hard

Fill all three blanks to check if the browser has multiple windows, close the current window, and then quit the session.

Selenium Python
if len(driver.window_handles) > [1]:
    driver.[2]()
driver.[3]()
Drag options to blanks, or click blank then click option'
A1
Bclose
Cquit
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 instead of 1 to check multiple windows.
Using quit() before close(), which may cause errors.
Using invalid methods like exit() or stop().