driver.close() #It closes the browser window on which the focus is set. driver.quit() #It basically calls the driver.dispose method which in turn closes all the browser windows and ends the WebDriver session gracefully.
Here is what the above code is Doing:
1. It opens the URL in the browser.
2. It maximizes the browser window.
3. It fetches the page title and prints it.
4. It navigates to the provided URL.
5. It fetches the page title and prints it.
6. It navigates back to the previous URL.
7. It refreshes the page.
8. It navigates forward to the next URL.
9. It closes the current browser window.
10. It quits the WebDriver session.