下面列出了怎么用org.openqa.selenium.firefox.internal.ProfilesIni的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public void start() throws CandybeanException {
String profileName = candybean.config.getValue("browser.firefox.profile", "default");
File ffBinaryPath = new File(candybean.config.getPathValue("browser.firefox.binary"));
if(!ffBinaryPath.exists()){
String error = "Unable to find firefox browser driver from the specified location in the configuration file! \n"
+ "Please add a configuration to the candybean config file for key \"browser.firefox.binary\" that"
+ "indicates the location of the binary.";
logger.severe(error);
throw new CandybeanException(error);
} else {
FirefoxProfile ffProfile = (new ProfilesIni()).getProfile(profileName);
FirefoxBinary ffBinary = new FirefoxBinary(ffBinaryPath);
logger.info("Instantiating Firefox with profile name: "
+ profileName + " and binary path: " + ffBinaryPath);
super.wd = new FirefoxDriver(ffBinary, ffProfile);
super.start(); // requires wd to be instantiated first
}
}