0
0
Selenium Javatesting~10 mins

Closing browser (close vs quit) in Selenium Java - 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 Java
driver.[1]();
Drag options to blanks, or click blank then click option'
Aclose
Bquit
Cexit
Dstop
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 valid WebDriver methods.
2fill in blank
medium

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

Selenium Java
driver.[1]();
Drag options to blanks, or click blank then click option'
Aclose
Bexit
Cshutdown
Dquit
Attempts:
3 left
💡 Hint
Common Mistakes
Using close() when multiple windows are open and the session should end.
Using shutdown() or exit(), which are not valid WebDriver methods.
3fill in blank
hard

Fix the error in the code to properly close all browser windows and end the session.

Selenium Java
driver.[1]();
Drag options to blanks, or click blank then click option'
Aquit
Bclose
Cstop
Dexit
Attempts:
3 left
💡 Hint
Common Mistakes
Using close() when quit() is needed to end the session.
Using stop() or exit(), which are invalid.
4fill in blank
hard

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

Selenium Java
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 invalid.
5fill in blank
hard

Fill all three blanks to correctly close the current window, then quit the session, and finally print a confirmation message.

Selenium Java
driver.[1]();
driver.[2]();
System.out.println("[3]");
Drag options to blanks, or click blank then click option'
Aclose
Bquit
CBrowser closed successfully
DSession ended
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong order of close() and quit().
Printing a message before closing or quitting.
Using an incorrect confirmation message.