com.lazerycode.selenium.repository.OperatingSystem Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of driver-binary-downloader-maven-plugin Show documentation
Show all versions of driver-binary-downloader-maven-plugin Show documentation
A plugin to automatically download individual selenium standalone binaries (e.g. chromedriver.exe) for your mavenised selenium project.
package com.lazerycode.selenium.repository;
import java.util.HashSet;
public enum OperatingSystem {
WINDOWS("windows"),
OSX("mac"),
LINUX("linux");
private String operatingSystemName;
OperatingSystem(String operatingSystemName) {
this.operatingSystemName = operatingSystemName;
}
String getOperatingSystemType() {
return operatingSystemName;
}
public static OperatingSystem getOperatingSystem(String osName) {
for (OperatingSystem operatingSystemName : values()) {
if (osName.toLowerCase().contains(operatingSystemName.getOperatingSystemType())) {
return operatingSystemName;
}
}
throw new IllegalArgumentException("Unrecognised operating system name '" + osName + "'");
}
public static HashSet getCurrentOperatingSystemAsAHashSet() {
String currentOperatingSystemName = System.getProperties().getProperty("os.name");
HashSet listOfOperatingSystems = new HashSet();
listOfOperatingSystems.add(getOperatingSystem(currentOperatingSystemName));
return listOfOperatingSystems;
}
public static OperatingSystem getCurrentOperatingSystem() {
String currentOperatingSystemName = System.getProperties().getProperty("os.name");
return getOperatingSystem(currentOperatingSystemName);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy