Reputation: 479
I want to use Cucumber framework with Selenium WebDriver+JAVA. This is for development of our automation framework. I automated many scenarios on FF browser. I want to run my tests on multiple browsers. I browsed through the net, couldn't get any concrete solution. Can some one please help me on its implementation.
src/main/java
> Has all the page objectssrc/main/resources
> Has nothingsrc/test/java
> Has RunTests.java
and TestRunner.java
src/test/resources
> Has my feature file.Any help on this will be greatly appreciated.
Upvotes: 1
Views: 1442
Reputation: 85
Please follow these steps that may be helpful for you
Download drivers of the browsers say IEDriver for internet explorer etc
Place the .exe file into your project
In the class that instantiate the webdriver or browser initialize the required browser like this:
private static DesiredCapabilities DESIRED_CAPABILITIES;
public static WebDriver getInstance() {
if (WEB_DRIVER == null)
{
WEB_DRIVER = new FirefoxDriver(DESIRED_CAPABILITIES);
}
return WEB_DRIVER;
}
Upvotes: 0
Reputation: 1259
Parameterise where you are instantiating your FF Webdriver object so that it can take a browser type, e.g. FF, Chrome, IE. From this variable return a different Webdriver object e.g. ChromeDriver, InternetExplorerDriver etc.
To learn about instantiating different browser types, search google or see: http://www.qaautomation.net/?p=373
From there you can feed this method a variable or set an environment variable through your CI (e.g. Jenkins) job which will hold the browser type for the test run.
Upvotes: 0