use of org.openqa.selenium.firefox.FirefoxBinary in project Asqatasun by Asqatasun.
the class FirefoxDriverFactory method make.
/**
*
* @param config
* @return A FirefoxDriver.
*/
@Override
public RemoteWebDriver make(HashMap<String, String> config) {
FirefoxBinary ffBinary = new FirefoxBinary();
if (System.getProperty(DISPLAY_PROPERTY) != null) {
ffBinary.setEnvironmentProperty(DISPLAY_PROPERTY.toUpperCase(), System.getProperty(DISPLAY_PROPERTY));
} else if (System.getenv(DISPLAY_PROPERTY.toUpperCase()) != null) {
ffBinary.setEnvironmentProperty(DISPLAY_PROPERTY.toUpperCase(), System.getenv(DISPLAY_PROPERTY.toUpperCase()));
}
RemoteWebDriver remoteWebDriver = new FirefoxDriver(ffBinary, firefoxProfile);
if (screenHeight != -1 && screenWidth != -1) {
remoteWebDriver.manage().window().setSize(new Dimension(screenWidth, screenHeight));
}
return remoteWebDriver;
}
use of org.openqa.selenium.firefox.FirefoxBinary in project Asqatasun by Asqatasun.
the class FirefoxDriverPoolableObjectFactory method makeObject.
@Override
public FirefoxDriver makeObject() throws Exception {
FirefoxBinary ffBinary = new FirefoxBinary();
if (System.getProperty(DISPLAY_PROPERTY_KEY) != null) {
Logger.getLogger(this.getClass()).info("Setting Xvfb display with value " + System.getProperty(DISPLAY_PROPERTY_KEY));
ffBinary.setEnvironmentProperty("DISPLAY", System.getProperty(DISPLAY_PROPERTY_KEY));
}
FirefoxDriver fd = new FirefoxDriver(ffBinary, ProfileFactory.getInstance().getScenarioProfile());
if (this.implicitelyWaitDriverTimeout != null) {
fd.manage().timeouts().implicitlyWait(this.implicitelyWaitDriverTimeout.longValue(), TimeUnit.SECONDS);
}
if (this.pageLoadDriverTimeout != null) {
fd.manage().timeouts().pageLoadTimeout(this.pageLoadDriverTimeout.longValue(), TimeUnit.SECONDS);
}
return fd;
}
use of org.openqa.selenium.firefox.FirefoxBinary in project mamute by caelum.
the class AcceptanceTestBase method buildDriver.
@BeforeClass
public static void buildDriver() {
// System.setProperty("webdriver.chrome.driver",
// "/home/csokol/programas/chromedriver/chromedriver");
// driver = new ChromeDriver();
String localTest = System.getenv("LOCAL_TEST");
if ("remote".equals(localTest)) {
driver = ghostDriver();
} else {
FirefoxBinary firefox = new FirefoxBinary();
String display = System.getProperty("DISPLAY", ":0");
firefox.setEnvironmentProperty("DISPLAY", display);
driver = new FirefoxDriver();
}
driver.manage().window().setSize(new Dimension(1280, 800));
waitForFirstBodyPresence();
}
use of org.openqa.selenium.firefox.FirefoxBinary in project Asqatasun by Asqatasun.
the class AbstractWebDriverTestClass method initialize.
/**
*/
private void initialize() {
// Mysql access parameters are passed as JVM argument
// dbUrl = System.getProperty(DB_URL_KEY);
// dbName = System.getProperty(DB_NAME_KEY);
// dbUser = System.getProperty(DB_USER_KEY);
// dbPassword = System.getProperty(DB_PASSWORD_KEY);
// initDb();
// These parameters has to passed as JVM argument
user = System.getProperty(USER_KEY);
password = System.getProperty(PASSWORD_KEY);
hostLocation = System.getProperty(HOST_LOCATION_KEY);
xvfbDisplay = System.getProperty(XVFB_DISPLAY_KEY);
pathToFirefox = System.getProperty(FIREFOX_PATH_KEY);
// createRootUserInDb();
ResourceBundle parametersBundle = ResourceBundle.getBundle(BUNDLE_NAME);
userFieldName = parametersBundle.getString(USER_FIELD_NAME_KEY);
passwordFieldName = parametersBundle.getString(PASSWORD_FIELD_NAME_KEY);
loginUrl = hostLocation + parametersBundle.getString(LOGIN_URL_KEY);
logoutUrl = hostLocation + parametersBundle.getString(LOGOUT_URL_KEY);
adminUrl = hostLocation + parametersBundle.getString(ADMIN_URL_KEY);
addUserUrl = hostLocation + parametersBundle.getString(ADD_USER_URL_KEY);
editUserUrl = hostLocation + parametersBundle.getString(EDIT_USER_URL_KEY);
deleteUserUrl = hostLocation + parametersBundle.getString(DELETE_USER_URL_KEY);
addContractUrl = hostLocation + parametersBundle.getString(ADD_CONTRACT_URL_KEY);
contractUrl = hostLocation + parametersBundle.getString(CONTRACT_URL_KEY);
auditPagesSetupUrl = hostLocation + parametersBundle.getString(AUDIT_PAGES_URL_KEY);
auditSiteSetupUrl = hostLocation + parametersBundle.getString(AUDIT_SITE_URL_KEY);
auditUploadSetupUrl = hostLocation + parametersBundle.getString(AUDIT_UPLOAD_URL_KEY);
auditScenarioSetupUrl = hostLocation + parametersBundle.getString(AUDIT_SCENARIO_URL_KEY);
addUserContractUrl = hostLocation + parametersBundle.getString(ADD_USER_CONTRACT_URL_KEY);
editUserContractUrl = hostLocation + parametersBundle.getString(EDIT_USER_CONTRACT_URL_KEY);
if (driver == null) {
FirefoxBinary ffBinary = new FirefoxBinary(new File(pathToFirefox));
if (xvfbDisplay != null) {
Logger.getLogger(this.getClass()).info("Setting Xvfb display with value " + xvfbDisplay);
ffBinary.setEnvironmentProperty("DISPLAY", xvfbDisplay);
}
driver = new FirefoxDriver(ffBinary, new FirefoxProfile());
}
}
use of org.openqa.selenium.firefox.FirefoxBinary in project NoraUi by NoraUi.
the class DriverFactory method generateFirefoxDriver.
/**
* Generates a firefox webdriver.
*
* @return
* A firefox webdriver
* @throws TechnicalException
* if an error occured when Webdriver setExecutable to true.
*/
private WebDriver generateFirefoxDriver() throws TechnicalException {
final String pathWebdriver = DriverFactory.getPath(Driver.FIREFOX);
if (!new File(pathWebdriver).setExecutable(true)) {
throw new TechnicalException(Messages.getMessage(TechnicalException.TECHNICAL_ERROR_MESSAGE_WEBDRIVER_SET_EXECUTABLE));
}
logger.info("Generating Firefox driver ({}) ...", pathWebdriver);
System.setProperty(Driver.FIREFOX.getDriverName(), pathWebdriver);
final FirefoxOptions firefoxOptions = new FirefoxOptions();
final FirefoxBinary firefoxBinary = new FirefoxBinary();
final DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true);
capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.ACCEPT);
setLoggingLevel(capabilities);
// Proxy configuration
if (Context.getProxy().getProxyType() != ProxyType.UNSPECIFIED && Context.getProxy().getProxyType() != ProxyType.AUTODETECT) {
capabilities.setCapability(CapabilityType.PROXY, Context.getProxy());
}
if (Context.isHeadless()) {
firefoxBinary.addCommandLineOptions("--headless");
firefoxOptions.setBinary(firefoxBinary);
}
firefoxOptions.setLogLevel(Level.OFF);
capabilities.setCapability(FirefoxOptions.FIREFOX_OPTIONS, firefoxOptions);
return new FirefoxDriver(capabilities);
}
Aggregations