Java Code Examples for org.openqa.selenium.remote.DesiredCapabilities.getBrowserName()
The following are Jave code examples for showing how to use
getBrowserName() of the
org.openqa.selenium.remote.DesiredCapabilities
class.
You can vote up the examples you like. Your votes will be used in our system to get
more good examples.
+ Save this method
Example 1
Project: selenium-camp-17 File: Java7WebDriverFactory.java View Source Code | 5 votes |
public static WebDriver getDriverUsingIf(DesiredCapabilities desiredCapabilities) { if (desiredCapabilities == null) { throw new IllegalStateException("DesiredCapabilities are missing!"); } final String browser = desiredCapabilities.getBrowserName(); if (CHROME.equalsIgnoreCase(browser)) { return new ChromeDriver(desiredCapabilities); } else if (FIREFOX.equalsIgnoreCase(browser)) { return new FirefoxDriver(desiredCapabilities); } else if (browser.isEmpty()) { throw new IllegalStateException("'browser' capability is missing!"); } throw new IllegalArgumentException(desiredCapabilities.getBrowserName() + " browser is not supported!"); }