Enum Platform

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Platform>

    public enum Platform
    extends java.lang.Enum<Platform>
    Represents the known and supported Platforms that WebDriver runs on. This is pretty close to the Operating System, but differs slightly, because this class is used to extract information such as program locations and line endings.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      ANDROID  
      ANY
      Never returned, but can be used to request a browser running on any operating system.
      EL_CAPITAN  
      HIGH_SIERRA  
      IOS  
      LINUX  
      MAC  
      MAVERICKS  
      MOJAVE  
      MOUNTAIN_LION  
      SIERRA  
      SNOW_LEOPARD  
      UNIX
      Many platforms have UNIX traits, amongst them LINUX, Solaris and BSD.
      VISTA
      For versions of Windows that "feel like" Windows Vista.
      WIN10  
      WIN8
      For versions of Windows that "feel like" Windows 8.
      WIN8_1  
      WINDOWS
      Never returned, but can be used to request a browser running on any version of Windows.
      XP
      For versions of Windows that "feel like" Windows XP.
      YOSEMITE  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static Platform extractFromSysProperty​(java.lang.String osName)
      Extracts platforms based on system properties in Java and uses a heuristic to determine the most likely operating system.
      static Platform extractFromSysProperty​(java.lang.String osName, java.lang.String osVersion)
      Extracts platforms based on system properties in Java and uses a heuristic to determine the most likely operating system.
      abstract Platform family()
      Returns a platform that represents a family for the current platform.
      static Platform fromString​(java.lang.String name)
      Gets a platform with the name matching the parameter.
      static Platform getCurrent()
      Get current platform (not necessarily the same as operating system).
      int getMajorVersion()
      Returns the major version of this platform.
      int getMinorVersion()
      Returns the minor version of this platform.
      java.lang.String[] getPartOfOsName()  
      boolean is​(Platform compareWith)
      Heuristic for comparing two platforms.
      static Platform valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static Platform[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • WINDOWS

        public static final Platform WINDOWS
        Never returned, but can be used to request a browser running on any version of Windows.
      • XP

        public static final Platform XP
        For versions of Windows that "feel like" Windows XP. These are ones that store files in "\Program Files\" and documents under "\\documents and settings\\username"
      • VISTA

        public static final Platform VISTA
        For versions of Windows that "feel like" Windows Vista.
      • WIN8

        public static final Platform WIN8
        For versions of Windows that "feel like" Windows 8.
      • WIN8_1

        public static final Platform WIN8_1
      • WIN10

        public static final Platform WIN10
      • SNOW_LEOPARD

        public static final Platform SNOW_LEOPARD
      • MOUNTAIN_LION

        public static final Platform MOUNTAIN_LION
      • MAVERICKS

        public static final Platform MAVERICKS
      • YOSEMITE

        public static final Platform YOSEMITE
      • EL_CAPITAN

        public static final Platform EL_CAPITAN
      • SIERRA

        public static final Platform SIERRA
      • HIGH_SIERRA

        public static final Platform HIGH_SIERRA
      • MOJAVE

        public static final Platform MOJAVE
      • UNIX

        public static final Platform UNIX
        Many platforms have UNIX traits, amongst them LINUX, Solaris and BSD.
      • LINUX

        public static final Platform LINUX
      • ANDROID

        public static final Platform ANDROID
      • ANY

        public static final Platform ANY
        Never returned, but can be used to request a browser running on any operating system.
    • Method Detail

      • values

        public static Platform[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Platform c : Platform.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Platform valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getPartOfOsName

        public java.lang.String[] getPartOfOsName()
      • getCurrent

        public static Platform getCurrent()
        Get current platform (not necessarily the same as operating system).
        Returns:
        current platform
      • extractFromSysProperty

        public static Platform extractFromSysProperty​(java.lang.String osName)
        Extracts platforms based on system properties in Java and uses a heuristic to determine the most likely operating system. If unable to determine the operating system, it will default to UNIX.
        Parameters:
        osName - the operating system name to determine the platform of
        Returns:
        the most likely platform based on given operating system name
      • extractFromSysProperty

        public static Platform extractFromSysProperty​(java.lang.String osName,
                                                      java.lang.String osVersion)
        Extracts platforms based on system properties in Java and uses a heuristic to determine the most likely operating system. If unable to determine the operating system, it will default to UNIX.
        Parameters:
        osName - the operating system name to determine the platform of
        osVersion - the operating system version to determine the platform of
        Returns:
        the most likely platform based on given operating system name and version
      • fromString

        public static Platform fromString​(java.lang.String name)
        Gets a platform with the name matching the parameter.
        Parameters:
        name - the platform name
        Returns:
        the Platform enum value matching the parameter
      • is

        public boolean is​(Platform compareWith)
        Heuristic for comparing two platforms. If platforms (which is not the same thing as operating systems) are found to be approximately similar in nature, this will return true. For instance the LINUX platform is similar to UNIX, and will give a positive result if compared.
        Parameters:
        compareWith - the platform to compare with
        Returns:
        true if platforms are approximately similar, false otherwise
      • family

        public abstract Platform family()
        Returns a platform that represents a family for the current platform. For instance the LINUX if a part of the UNIX family, the XP is a part of the WINDOWS family.
        Returns:
        the family platform for the current one, or null if this Platform represents a platform family (such as Windows, or MacOS)
      • getMajorVersion

        public int getMajorVersion()
        Returns the major version of this platform.
        Returns:
        the major version of specified platform
      • getMinorVersion

        public int getMinorVersion()
        Returns the minor version of this platform.
        Returns:
        the minor version of specified platform