List of usage examples for org.openqa.selenium Platform getCurrent
public static Platform getCurrent()
From source file:com.vilt.minium.script.MiniumScriptEngineTest.java
License:Apache License
@Test public void testModulePathURIs() throws Exception { // given/* w w w . j av a 2 s . c o m*/ System.setProperty("basedir", Platform.getCurrent().is(Platform.WINDOWS) ? "c:\\minium-app" : "/opt/minium-app"); Reader reader = Resources.asCharSource(Resources.getResource("minium-prefs.json"), Charsets.UTF_8) .openStream(); AppPreferences preferences = new AppPreferences(reader); MiniumScriptEngine engine = new MiniumScriptEngine(RhinoPreferences.from(preferences)); // when List<String> modulePathURIs = engine.getModulePathURIs(); // then String modules = Platform.getCurrent().is(Platform.WINDOWS) ? "file:/c:/minium-app/modules" : "file:/opt/minium-app/modules"; assertThat(modulePathURIs, containsInAnyOrder(modules, "http://www.lodash.com")); }
From source file:crazy.seleiumTools.ProfilesIni.java
License:Apache License
public ProfilesIni() { File appData = locateAppDataDirectory(Platform.getCurrent()); profiles = readProfiles(appData); getinfoOfPro(); }
From source file:io.appium.java_client.localserver.ServerBuilderTest.java
License:Apache License
private static File findCustomNode() { Platform current = Platform.getCurrent(); if (current.is(Platform.WINDOWS)) return new File(String.valueOf(properties.get("path.to.custom.node.win"))); if (current.is(Platform.MAC)) return new File(String.valueOf(properties.get("path.to.custom.node.macos"))); return new File(String.valueOf(properties.get("path.to.custom.node.linux"))); }
From source file:io.appium.java_client.service.local.AppiumServiceBuilder.java
License:Apache License
private static String returnCommandThatSearchesForDefaultNode() { if (Platform.getCurrent().is(Platform.WINDOWS)) return COMMAND_WHICH_EXTRACTS_DEFAULT_PATH_TO_APPIUM_WIN; return COMMAND_WHICH_EXTRACTS_DEFAULT_PATH_TO_APPIUM; }
From source file:io.appium.java_client.service.local.AppiumServiceBuilder.java
License:Apache License
private static String defineNodeCommandPrefix() { if (Platform.getCurrent().is(Platform.WINDOWS)) return "cmd.exe /C"; else/*ww w. jav a2 s . co m*/ return "/bin/bash -l -c"; }
From source file:io.selendroid.android.JavaSdk.java
License:Apache License
public static String javaHome() { if (javaHome == null) { // Sniff JAVA_HOME first javaHome = System.getenv("JAVA_HOME"); // If that's not present, and we're on a Mac... if (javaHome == null && Platform.getCurrent() == MAC) { try { javaHome = ShellCommand.exec(new CommandLine("/usr/libexec/java_home")); if (javaHome != null) { javaHome = javaHome.replaceAll("\\r|\\n", ""); }/* w ww . j av a 2 s .co m*/ } catch (ShellCommandException e) { } } // Finally, check java.home, though this may point to a JRE. if (javaHome == null) { javaHome = System.getProperty("java.home"); } } return javaHome; }
From source file:minium.web.config.services.DriverServicesProperties.java
License:Apache License
protected File findExecutable(String exeName) { File driversDir = getDriversDir(); if (driversDir == null) return null; String osSpecificExeName = Platform.getCurrent().is(Platform.WINDOWS) ? exeName + ".exe" : exeName; File exeFile = new File(driversDir, osSpecificExeName); return exeFile.exists() && exeFile.isFile() && exeFile.canExecute() ? exeFile : null; }
From source file:org.glassfish.tyrus.tests.qa.SeleniumToolkit.java
License:Open Source License
public static boolean onWindows() { return Platform.WINDOWS.is(Platform.getCurrent()); }
From source file:org.glassfish.tyrus.tests.qa.SeleniumToolkit.java
License:Open Source License
public static boolean onMac() { return Platform.MAC.is(Platform.getCurrent()); }
From source file:org.jboss.arquillian.drone.webdriver.utils.Validate.java
License:Apache License
/** * Find the executable by scanning the file system and the PATH. In the case of Windows this * method allows common executable endings (".com", ".bat" and ".exe") to be omitted. * * @param command//from ww w . j av a 2 s . co m * The name of the executable to find * * @return Whether the command is executable or not. */ public static boolean isCommandExecutable(String command) throws IllegalArgumentException { File file = new File(command); if (fileExecutableChecker.canExecute(file)) { return true; } if (Platform.getCurrent().is(WINDOWS)) { file = new File(command + ".exe"); if (fileExecutableChecker.canExecute(file)) { return true; } } final List<String> pathSegmentBuilder = new ArrayList<>(); addPathFromEnvironment(pathSegmentBuilder); if (Platform.getCurrent().is(Platform.MAC)) { addMacSpecificPath(pathSegmentBuilder); } for (String pathSegment : pathSegmentBuilder) { for (String ending : ENDINGS) { file = new File(pathSegment, command + ending); if (fileExecutableChecker.canExecute(file)) { return true; } } } return false; }