I want to perform multiple browser testing: While working on a project i needed to open multiple browsers simultaneously using Webdriver script.
Does anyone have experience in implementing this ?
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It only takes a minute to sign up.
Sign up to join this communityWhether you want the ability to change the driver per execution of your tests, or simply rerun each test with multiple drivers, it's pretty straightforward. First you need to follow all of the instructions to get your drivers and browsers set up for the first execution. http://seleniumhq.org/docs/03_webdriver.jsp#selenium-webdriver-s-drivers.
In your code, it's also pretty straightforward, however you didn't mention a specific language or tool you're using to drive the automated tests... In C# some code may look like this:
switch (browser)
{
case "Chrome":
webDriver = new ChromeDriver();
break;
case "IE":
webDriver = new InternetExplorerDriver();
break;
case "Firefox":
FirefoxProfile profile = new FirefoxProfile();
profile.AcceptUntrustedCertificates = true;
webDriver = new FirefoxDriver(profile);
break;
default:
Trace.WriteLine(String.Format("Browser '{0}' not recognized. Spawning default Firefox browser.", browser));
webDriver = new FirefoxDriver();
break;
}
If you wanted to execute everything in every browser (or at least every browser installed on a single machine), you could either create a foreach loop in your code, or if you're using something like nunit to execute the test cases, you could create parameterized tests that execute once for each parameter.
If you want additional info about how to execute on multiple versions of the same browser, or more detail about using a tool like nunit (or your specific tool) please clarify in your question.
I am not familiar with "Webdriver script", so I assume you are referring to a program that uses Selenium. You can write a program that opens multiple Drivers to talk to multiple simultaneous browsers. If you want that activity to happen in parallel, you will need to use multiple threads.
The specifics around how you open Drivers and use multiple threads depend upon the programming language.