Saturday, December 3, 2016

WebDriver - Using Firefox, IE & Chrome Browsers

WebDriver - Using Firefox, IE & Chrome Browsers


You can see examples of using different browsers. First example shows using Firefox browser, second example uses IE and lastly you can see an example for Chrome browser.

Create a new project.

Add reference for Selenium WebDriver.


Example 1 - Launching Firefox Browser

Below code uses Firefox browser and opens www.google.com.

Example 2 - Launching IE Browser


While running the above code if you do not give the path for IEDriverServer then below exception (DriverServiceNotFoundException) will be shown. So you have to download the IEDriverServer and give its path (for example @"D:\IE\") as shown above.


For using Firefox we don't need to give this Driver Server path as its built-in for Firefox.

Example 3 - Launching Chrome Browser

Similar is the case while using the Chrome browser. You have to download the chrome driver and give its path otherwise below exception is thrown.