Enum Class Platform

java.lang.Object
java.lang.Enum<Platform>
org.openqa.selenium.Platform
All Implemented Interfaces:
Serializable, Comparable<Platform>, Constable

public enum Platform extends 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 Details

    • 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.
    • WIN7

      public static final Platform WIN7
    • 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
    • WIN11

      public static final Platform WIN11
    • MAC

      public static final Platform MAC
    • 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
    • CATALINA

      public static final Platform CATALINA
    • BIG_SUR

      public static final Platform BIG_SUR
    • MONTEREY

      public static final Platform MONTEREY
    • VENTURA

      public static final Platform VENTURA
    • SONOMA

      public static final Platform SONOMA
    • 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
    • IOS

      public static final Platform IOS
    • ANY

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

    • values

      public static Platform[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Platform valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getCurrent

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

      public static Platform extractFromSysProperty(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(String osName, 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(String name)
      Gets a platform with the name matching the parameter.
      Parameters:
      name - the platform name
      Returns:
      the Platform enum value matching the parameter
    • getPartOfOsName

      public String[] getPartOfOsName()
    • 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