use of org.openqa.selenium.remote.DesiredCapabilities in project java-client by appium.
the class SelendroidModeTest method beforeClass.
/**
* initialization.
*/
@BeforeClass
public static void beforeClass() {
AppiumServiceBuilder builder = new AppiumServiceBuilder();
service = builder.build();
service.start();
File appDir = new File("src/test/java/io/appium/java_client");
File app = new File(appDir, "ApiDemos-debug.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
capabilities.setCapability(AndroidMobileCapabilityType.SELENDROID_PORT, SELENDROID_PORT);
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.SELENDROID);
driver = new AndroidDriver<>(service.getUrl(), capabilities);
driver.context("NATIVE_APP");
}
use of org.openqa.selenium.remote.DesiredCapabilities in project java-client by appium.
the class IOSMobileBrowserCompatibilityTest method setUp.
/**
* The setting up.
*/
@Before
public void setUp() {
service = AppiumDriverLocalService.buildDefaultService();
service.start();
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, MobileBrowserType.SAFARI);
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9.2");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone Simulator");
// sometimes environment has performance problems
capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
driver = new IOSDriver<>(service.getUrl(), capabilities);
PageFactory.initElements(new AppiumFieldDecorator(driver, 5, TimeUnit.SECONDS), this);
}
use of org.openqa.selenium.remote.DesiredCapabilities in project chrome_page_performance_sqlite_java by sergueik.
the class ChromePagePerformanceObjectTest method beforeClass.
@SuppressWarnings("deprecation")
@BeforeClass
public static void beforeClass() throws IOException {
getOsName();
System.setProperty("webdriver.chrome.driver", osName.toLowerCase().startsWith("windows") ? new File("c:/java/selenium/chromedriver.exe").getAbsolutePath() : "/var/run/chromedriver");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
Map<String, Object> chromePrefs = new HashMap<>();
chromePrefs.put("profile.default_content_settings.popups", 0);
String downloadFilepath = System.getProperty("user.dir") + System.getProperty("file.separator") + "target" + System.getProperty("file.separator");
chromePrefs.put("download.default_directory", downloadFilepath);
chromePrefs.put("enableNetwork", "true");
options.setExperimentalOption("prefs", chromePrefs);
for (String option : (new String[] { "allow-running-insecure-content", "allow-insecure-localhost", "enable-local-file-accesses", "disable-notifications", /* "start-maximized" , */
"browser.download.folderList=2", "--browser.helperApps.neverAsk.saveToDisk=image/jpg,text/csv,text/xml,application/xml,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/excel,application/pdf", String.format("browser.download.dir=%s", downloadFilepath) /* "user-data-dir=/path/to/your/custom/profile" , */
})) {
options.addArguments(option);
}
// options for headless
if (headless) {
// headless option arguments
for (String option : (osName.toLowerCase().startsWith("windows")) ? new String[] { "headless", "disable-gpu", "disable-plugins", "window-size=1200x600", "window-position=-9999,0" } : new String[] { "headless", "disable-gpu", "remote-debugging-port=9222", "window-size=1200x600" }) {
options.addArguments(option);
}
// on Windows need ChromeDriver 2.31 / Chrome 60 to support headless
// With earlier versions of chromedriver: chrome not reachable...
// https://developers.google.com/web/updates/2017/04/headless-chrome
// https://stackoverflow.com/questions/43880619/headless-chrome-and-selenium-on-windows
}
//
capabilities.setBrowserName(DesiredCapabilities.chrome().getBrowserName());
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
driver = new ChromeDriver(capabilities);
try {
// origin:
// https://www.tutorialspoint.com/sqlite/sqlite_java.htm
Class.forName("org.sqlite.JDBC");
// String dbURL = "jdbc:sqlite:performance.db";
conn = DriverManager.getConnection("jdbc:sqlite:performance.db");
if (conn != null) {
// System.out.println("Connected to the database");
DatabaseMetaData databaseMetadata = conn.getMetaData();
System.out.println("Driver name: " + databaseMetadata.getDriverName());
System.out.println("Driver version: " + databaseMetadata.getDriverVersion());
System.out.println("Product name: " + databaseMetadata.getDatabaseProductName());
System.out.println("Product version: " + databaseMetadata.getDatabaseProductVersion());
createNewTable();
// insertData("name", 1.0);
// conn.close();
}
} catch (ClassNotFoundException | SQLException ex) {
ex.printStackTrace();
} finally {
}
assertThat(driver, notNullValue());
}
use of org.openqa.selenium.remote.DesiredCapabilities in project ghostdriver by detro.
the class BaseTest method configure.
@BeforeClass
public static void configure() throws IOException {
// Read config file
sConfig = new Properties();
sConfig.load(new FileReader(CONFIG_FILE));
// Prepare capabilities
sCaps = new DesiredCapabilities();
sCaps.setJavascriptEnabled(true);
sCaps.setCapability("takesScreenshot", false);
String driver = sConfig.getProperty("driver", DRIVER_PHANTOMJS);
// Fetch PhantomJS-specific configuration parameters
if (driver.equals(DRIVER_PHANTOMJS)) {
// "phantomjs_exec_path"
if (sConfig.getProperty("phantomjs_exec_path") != null) {
sCaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, sConfig.getProperty("phantomjs_exec_path"));
} else {
throw new IOException(String.format("Property '%s' not set!", PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY));
}
// "phantomjs_driver_path"
if (sConfig.getProperty("phantomjs_driver_path") != null) {
System.out.println("Test will use an external GhostDriver");
sCaps.setCapability(PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY, sConfig.getProperty("phantomjs_driver_path"));
} else {
System.out.println("Test will use PhantomJS internal GhostDriver");
}
}
// Disable "web-security", enable all possible "ssl-protocols" and "ignore-ssl-errors" for PhantomJSDriver
// sCaps.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new String[] {
// "--web-security=false",
// "--ssl-protocol=any",
// "--ignore-ssl-errors=true"
// });
ArrayList<String> cliArgsCap = new ArrayList<String>();
cliArgsCap.add("--web-security=false");
cliArgsCap.add("--ssl-protocol=any");
cliArgsCap.add("--ignore-ssl-errors=true");
sCaps.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, cliArgsCap);
// Control LogLevel for GhostDriver, via CLI arguments
sCaps.setCapability(PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_CLI_ARGS, new String[] { "--logLevel=" + (sConfig.getProperty("phantomjs_driver_loglevel") != null ? sConfig.getProperty("phantomjs_driver_loglevel") : "INFO") });
}
use of org.openqa.selenium.remote.DesiredCapabilities in project java.webdriver by sayems.
the class IEBrowser method getDesiredCapabilities.
@Override
public DesiredCapabilities getDesiredCapabilities(Proxy proxySettings) {
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true);
capabilities.setCapability(InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING, true);
capabilities.setCapability("requireWindowFocus", true);
capabilities.setCapability("screenResolution", "1280x1024");
return addProxySettings(capabilities, proxySettings);
}
Aggregations