Header Ads

HOW TO PERFORM CROSS BROWSER TESTING USING SELENIUM WEBDRIVER?

We can perform cross browser testing using Selenium Webdriver. In cross browser testing we can run same Selenium automation programs on different web browser like Firefox, Chrome, IE, Safari, Opera.

To run the Selenium Webdriver programs on different web browser we need to download drivers for particular web browser. Below are example for use of drivers to perform cross browser testing:

1. Firefox Driver: This is an inbuilt driver in Selenium Webdriver to run the programs on Firefox web browser. To use this driver Firefox web browser must be installed on machine. Below is the sample code to initialize firefox driver in Selenium program:
Java Source code:
WebDriver driver = new FirefoxDriver();

Read more about HOW TO WRITE FIRST SELENIUM WEBDRIVER SCRIPT?





2. Chrome Driver: Chrome driver is used in Selenium Webdriver to run the programs on Chromer web browser. Latest version of chrome driver can be downloaded from http://docs.seleniumhq.org/download/. To use this driver Chrome web browser must be installed on machine. Below is the sample code to initialize chrome driver in Selenium program:


Java Source code:
File chromeDriver = new File("path of the chromedriver (.exe file)");
System.setProperty("webdriver.chrome.driver", chromeDriver.getAbsolutePath() );  
Webdriver driver = new ChromeDriver();

Read more about HOW TO RUN SELENIUM WEBDRIVER SCRIPT IN GOOGLE CHROME BROWSER?

3. Internet Explorer Driver: Internet Explorer driver is used in Selenium Webdriver to run the programs on IE web browser. Latest version of internet explorer driver can be downloaded from http://docs.seleniumhq.org/download/. To use this driver IE web browser must be installed on machine. Below is the sample code to initialize internet explorer driver in Selenium program:


Java Source code:
File IEDriver = new File("path of the IEDriverServer (.exe file)");
System.setProperty("webdriver.ie.driver", IEDriver.getAbsolutePath() );  
Webdriver driver = new InternetExplorerDriver();  

Read more about HOW TO RUN SELENIUM WEBDRIVER SCRIPT IN IE BROWSER?


No comments


What would you like to add in my list? I look forward to reading your comments below.



Powered by Blogger.