-
Notifications
You must be signed in to change notification settings - Fork 22
Using webdriver factory standalone
Catalin edited this page May 22, 2019
·
5 revisions
You may use the webdriver factory in isolation, however is not required if cinnamon-webdriver
has already been added as a dependency:
<dependency>
<groupId>com.nttdata</groupId>
<artifactId>cinnamon-webdriver-factory</artifactId>
<version>0.0.2</version>
</dependency>
In your code use CinnamonWebDriverConfig:
public class MyProject {
public static void main(String [] args) {
DriverConfig driverConfig = CinnamonWebDriverConfig.driverConfig();
String remoteUrl = CinnamonWebDriverConfig.hubUrl();
WebDriver driver = WebDriverFactory.getDriver(driverConfig.desiredCapabilities(), remoteUrl);
driver.get("http://www.google.com");
//Do some awesome testing
driver.quit();
}
}
In order to specify which browser profile is needed for the execution -DbrowserProfile
system property needs to be set.
To execute the above for chrome, run:
mvn clean install -DbrowserProfile=chrome
or java -jar -DbrowserProfile=chrome
To excecute the above for firefox, run:
mvn clean install -DbrowserProfile=firefox
For simple browser configurations, no further setup is required. Cinnamon currently provides browser profiles out of the box for Chrome, Firefox, Internet Explorer, Edge and Safari.