com.nordstrom.automation.selenium.plugins.OperaCaps Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium-foundation Show documentation
Show all versions of selenium-foundation Show documentation
Selenium Foundation is an automation framework designed to extend and enhance the capabilities provided by Selenium (WebDriver).
package com.nordstrom.automation.selenium.plugins;
import java.io.File;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import com.nordstrom.automation.selenium.exceptions.DriverExecutableNotFoundException;
import com.nordstrom.automation.selenium.utility.BinaryFinder;
public class OperaCaps {
private OperaCaps() {
throw new AssertionError("OperaCaps is a static constants class that cannot be instantiated");
}
public static final String DRIVER_NAME = "opera";
public static final String DRIVER_PATH = "webdriver.opera.driver";
public static final String BINARY_PATH = "webdriver.opera.bin";
public static final String LOGFILE_PATH = "webdriver.opera.logfile";
public static final String VERBOSE_LOG = "webdriver.opera.verboseLogging";
public static final String SILENT_MODE = "webdriver.opera.silentOutput";
public static final String OPTIONS_KEY = "operaOptions";
private static final String[] PROPERTY_NAMES =
{ DRIVER_PATH, BINARY_PATH, LOGFILE_PATH, VERBOSE_LOG, SILENT_MODE };
private static final String CAPABILITIES =
"{\"browserName\":\"opera\"}";
private static final String BASELINE =
"{\"browserName\":\"opera\"," +
"\"nord:options\":{\"personality\":\"opera\"," +
"\"pluginClass\":\"com.nordstrom.automation.selenium.plugins.OperaPlugin\"}}";
private static final Map PERSONALITIES;
static {
Map personalities = new HashMap<>();
personalities.put(DRIVER_NAME, BASELINE);
PERSONALITIES = Collections.unmodifiableMap(personalities);
}
public static String getCapabilities() {
return CAPABILITIES;
}
public static Map getPersonalities() {
return PERSONALITIES;
}
public static String[] getPropertyNames(String capabilities) {
try {
File driverPath = BinaryFinder.findDriver(capabilities);
System.setProperty(DRIVER_PATH, driverPath.getAbsolutePath());
} catch (IllegalStateException e) {
throw new DriverExecutableNotFoundException(DRIVER_PATH);
}
return PROPERTY_NAMES;
}
}