org.openqa.selenium
Enum Platform

java.lang.Object
  extended by java.lang.Enum<Platform>
      extended by org.openqa.selenium.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
ANDROID
           
ANY
          Never returned, but can be used to request a browser running on any operating system.
LINUX
           
MAC
           
UNIX
          Many platforms have UNIX traits, amongst them LINUX, Solaris and BSD.
VISTA
          For versions of Windows that "feel like" Windows Vista.
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.
 
Method Summary
static Platform extractFromSysProperty(java.lang.String osName)
          Extracts platforms based on system properties in Java and a heuristic to determine the most likely operating system.
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.


MAC

public static final Platform MAC

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 a heuristic to determine the most likely operating system. If not able 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

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

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


Copyright © 2011. All Rights Reserved.