How to stop WebDriver in Selenium?

How to stop WebDriver in Selenium?

Selenium is not a browser.

This technology does not work with browsers. Selenium creates browser-like web application and drives its pages. So whenever we talk about WebDriver, in mind, we consider only websites(and they work by HTTP protocol). You can find how to handle and control the real browser from our WebDriver documentation. But this doesn't mean we have no ways to stop webdriver completely, at least in simple cases. For example, when you want to navigate one page in selenium and then decide that you don't need to go further. To stop WebDriver and do other tasks like opening an URL, handling your keyboard etc. Is very easy. We just use some special keywords for that. We call them Stop keywords.

There are so many different ways to do stop keywords but for us the most efficient and most simple way is use Page Object Pattern (as explained in our previous post of course). So in this post I will explain to you about different ways to stop webdriver by using Page Object and also I will demonstrate you two very simple ways: in one case we will navigate to a particular URL on our website, and in the other we will close all our webpages on our website to exit from our website. All browsers are similar and all have their unique behavior. For example, if you use chrome and visit the webpage at the beginning it will ask you to install Google Chrome browser on your system. If you agree, then it will take some time to install and launch the browser. After installing, it will ask you whether you want to open that website on that specific port or not. If you say yes then it will ask you where you want to download the application files from. It is not necessary to download the files locally. Because we know there are more than 5 billions of internet users around the world who have already installed this browser on their system. So instead of downloading it from the original site, now it can download it from google. It is called web caching. And as soon as it is installed and opens your webpage, it will be done automatically. So whatever you have typed in your browser, it will be saved in its cache. All these things are done using different cookies which you probably don't know anything about.

Related Answers

How can we use the Selenium tool with HeadSpin?

Selenium is a tool that is used to automate functional testing. There are two types...

What are 5 Uses of Selenium?

Selenium is a web-automation tool that helps you to test web applications....

Whats the focus of this Selenium Certification Training?

You can learn it in a week. You just have to know the basics about what we...