All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lazerycode.selenium.repository.OperatingSystem Maven / Gradle / Ivy

Go to download

A plugin to automatically download individual selenium standalone binaries (e.g. chromedriver.exe) for your mavenised selenium project.

There is a newer version: 1.0.18
Show newest version
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