Run Webdriver in Chrome and IE Browser

Let’s see, How can you Run Webdriver in Chrome and IE Browser. Normally, To execute Selenium scripts we need, selenium automation script, browser and selenium server jar files. By default selenium, web driver supports Firefox browser.

 

Run Webdriver in Chrome and IE Browser

To execute selenium code with other browsers we need to configure these browser drivers with selenium. These drivers communicate with the Selenium server and code gets executed over these browsers. To configure the other browsers with Selenium, We need to add driver .exe files with selenium.

Let’s see how we can configure the Selenium with other browsers-

 

Run Webdriver with Chrome Browser

To start working with selenium + Chrome, First of all, you need to download the chrome driver. (Download Chrome Driver from here!)

 

Go to this page chick on the present link after text “Latest Release“. From here download the .exe file which supports your OS. As I am working on windows so I will get the windows version.

Chrome Driver

 

Now click on this .zip file and download it. After download, you need to unzip the folder and keep that “chromedriver.exe” file on your local machine.

 

Video Tutorial:

If you liked this video, then please subscribe to our YouTube Channel for more video tutorials.

 

After this to execute your selenium code on Chrome, you need to set the system property. We can set system property like this –

Syntax – System.setProperty(“webdriver.chrome.driver”, “pathofchromedriver.exe file”);

Let’s understand this with the easy example, Here we are going to write our first Selenium code.

(Please follow the comments in code for the better clarity)

 

So in the above example, We are opening the Seleniumbix in Chrome browser.

Please note, In above example, we are providing the URL with the protocol. It is mandatory to append the protocol with the URL otherwise it will not open the URL.

 

Run Webdriver with IE Browser

To start working with selenium + IE, First of all, you need to download the IE driver Server. (Download IE Driver from here!)

 

Go to this page chick latest release. From here download the .exe file which supports your OS. As I am working on Windows 64-bit os so I will get the  64-bit  version.

IE Driver with Selenium

Now click on this .zip file and download it. After download, you need to unzip the folder and keep that “IEDriverServer.exe” file on your local machine.

 

After this to execute your selenium code with IE, you need to set the system property. We can set system property like this –

Syntax – System.setProperty(“webdriver.ie.driver”, “pathofIEDriverServer.exe file”);

Let’s understand this with the easy example, Here we are going to write our first Selenium code.

 

The above code will open the Easybix.com in IE browser.

IE is available on Windows machines only and it comparatively slow to other browsers. It is not recommended to use IE with Selenium. If you are using IE with selenium then you may experience some issues like selenium synchronization, Element not found, Issue with mouse movement and Javascript executors.

 

So we have seen, How can we execute our Test scripts with Chrome and IE browsers. It is the very important concept for cross browser testing and from interview purpose as well. In later tutorials, we will see how can we decide the browser at the running time.

0 Comment

Leave a Reply