You can modify this:
/**
* This is a global that is initialized when the DOTN_Helper class is
* instantiated. It is used to control the DOTN session and is accessed by
* all the various methods in the classes that extend the base DOTN_Helper
* class. We create this object using the WebDriver object we used to start
* the session. You get more control over the web page using this than you
* have with just the WebDriver, but it can run slower for some methods.
*/
public WebDriverBackedSelenium selenium; // Used for WebDriver and RemoteWebDriver
/**
* This is used to create a selenium object that is backed by a Web Driver.
*/
public RemoteWebDriver driver; // Used for RemoteWebDriver
/**
* This is the browser we are using for this test. Pulled from testParams
*/
public String browserName;
/**
* This is the base URL we are using for this test. Pulled from testParams
*/
public String baseUrlString;
/**
* This is the list of browsers that we support when using WebDriver or
* RemoteWebDriver.<p>
* The allowed values are:
* <ul>
* <li>*firefox</li>
* <li>*iexplore</li>
* <li>googlechrome</li>
* <li>htmlunit</li>
* <li>safari - Not support yet by Selenium as of 2.5.0</li>
* <li>opera</li>
* </ul>
*/
private final String[] BROWSERS =
{
"*firefox",
"*iexplore",
"googlechrome",
"htmlunit",
"safari",
"opera"
};
/**
* DOTN_Helper is a creator for the base class DOTN_Helper used by the
* DOTN_Helper library. This version of the constructor is used if you want
* to use the RemoteWebDriver to run the test session, but use this library.
* It will create the WebDriver object and a DefaultSelenium object backed
* by the RemoteWebDriver.<BR/><BR/>
* For Firefox it will expect a directory called "Firefox#.profile" in the
* current directory, where '#' is the version number passed in the
* testParameters argument. This profile is simply the directory used by
* that version of Firefox to configure how that version should behave. If
* you do not supply a specific profile the Firefox browser gets invoked
* with a blank (re: default) profile, which may not have settings you want.
* @param testParameters
* @throws Exception
*/
public DOTN_Helper(TestParameters testParameters) throws Exception
{
String str;
org.openqa.selenium.remote.DesiredCapabilities capability;
String[] chromeSwitches =
{
"--ignore-certificate-errors"
};
FirefoxProfile ffProfile;
switch (Parser.findString(browserName, BROWSERS))
{
case 0:
capability = DesiredCapabilities.firefox();
str = "Firefox" + browserVersion + ".profile";
ffProfile = new FirefoxProfile(new File(str));
capability.setCapability(FirefoxDriver.PROFILE, ffProfile);
browser = FIREFOX;
break;
case 1:
capability = DesiredCapabilities.internetExplorer();
browser = INTERNET_EXPLORER;
break;
case 2:
capability = DesiredCapabilities.chrome();
capability.setCapability("chrome.switches",
Arrays.asList(chromeSwitches));
//capability.setCapability("chrome.binary",
// "C:\\Program Files\\Google\\Google Chrome\\chrome.exe");
browser = CHROME;
break;
case 3:
capability = DesiredCapabilities.htmlUnit();
capability.setJavascriptEnabled(true); // Off by default for htmlUnit
browser = HTML_UNIT;
break;
case 4:
capability = DesiredCapabilities.safari();
browser = SAFARI;
break;
case 5:
capability = DesiredCapabilities.opera();
capability.setCapability("opera.logging.level", "FINE");
browser = OPERA;
break;
default:
throw new Exception("Unknown browser name for RemoteWebDriver: " +
browserName + ".");
} // switch
if (platform.equalsIgnoreCase("WINDOWS") || browserName.equals(
"*iexplore"))
capability.setPlatform(Platform.WINDOWS);
else
capability.setPlatform(Platform.ANY);
capability.setVersion(browserVersion);
Reporter.log("Trying to start test session with: " +
capability.toString(), true);
driver = new RemoteWebDriver(new URL("http://" + host + ":" + port +
"/wd/hub"), capability);
try
{ // We have a session started, don't leave it as an orphan now
str = "Information from navigator object in browser:" +
"\nuserAgent: " +
driver.executeScript("return window.navigator.userAgent") +
"\nappCodeName: " +
driver.executeScript("return window.navigator.appCodeName") +
"\nappVersion: " +
driver.executeScript("return window.navigator.appVersion") +
"\nlanguage: " +
driver.executeScript("return window.navigator.language") +
"\nplatform: " +
driver.executeScript("return window.navigator.platform") +
"\n";
System.out.print(str);
str = str.replace("\n", "<br />");
Reporter.log(str);
selenium = new WebDriverBackedSelenium(driver, baseUrlString);
selenium.open(baseUrlString);
} // try
catch (Exception ex)
{ // We had an exception after creating the WebDriver instance
tearDown(); // Make sure we close the browser down
throw ex; // Now report the exception
} // catch
} // DOTN_Helper */