Package com.vaadin.testbench.parallel
Class BrowserUtil
java.lang.Object
com.vaadin.testbench.parallel.BrowserUtil
Provides helper method for selecting the browser to run on
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.openqa.selenium.remote.DesiredCapabilities
chrome()
Gets the capabilities for Chromestatic org.openqa.selenium.remote.DesiredCapabilities
edge()
Gets the capabilities for Edgestatic org.openqa.selenium.remote.DesiredCapabilities
firefox()
Gets the capabilities for Firefoxstatic TestBenchBrowserFactory
Gets the BrowserFactory used to generate new DesiredCapabilitiesstatic String
getBrowserIdentifier
(org.openqa.selenium.Capabilities capabilities) Returns a human readable identifier of the given browser.static String
getPlatform
(org.openqa.selenium.Capabilities capabilities) Returns a human readable identifier of the platform described by the given capabilities.static boolean
isChrome
(org.openqa.selenium.Capabilities capabilities) static boolean
isEdge
(org.openqa.selenium.Capabilities capabilities) static boolean
isFirefox
(org.openqa.selenium.Capabilities capabilities) static boolean
isSafari
(org.openqa.selenium.Capabilities capabilities) static org.openqa.selenium.remote.DesiredCapabilities
safari()
Gets the capabilities for Safaristatic void
setBrowserFactory
(TestBenchBrowserFactory browserFactory) Sets new BrowserFactory to generate default DesiredCapabilities for each Browser.
Extend BrowserFactory and override its methods in order to add default version, platform or other capabilities.
-
Constructor Details
-
BrowserUtil
public BrowserUtil()
-
-
Method Details
-
safari
public static org.openqa.selenium.remote.DesiredCapabilities safari()Gets the capabilities for Safari- Returns:
- an object describing the capabilities required for running a test on Safari
-
chrome
public static org.openqa.selenium.remote.DesiredCapabilities chrome()Gets the capabilities for Chrome- Returns:
- an object describing the capabilities required for running a test on Chrome
-
firefox
public static org.openqa.selenium.remote.DesiredCapabilities firefox()Gets the capabilities for Firefox- Returns:
- an object describing the capabilities required for running a test on Firefox
-
edge
public static org.openqa.selenium.remote.DesiredCapabilities edge()Gets the capabilities for Edge- Returns:
- an object describing the capabilities required for running a test on Edge
-
isEdge
public static boolean isEdge(org.openqa.selenium.Capabilities capabilities) - Parameters:
capabilities
- The capabilities to check- Returns:
- true if the capabilities refer to Edge, false otherwise
-
isChrome
public static boolean isChrome(org.openqa.selenium.Capabilities capabilities) - Parameters:
capabilities
- The capabilities to check- Returns:
- true if the capabilities refer to Chrome, false otherwise
-
isSafari
public static boolean isSafari(org.openqa.selenium.Capabilities capabilities) - Parameters:
capabilities
- The capabilities to check- Returns:
- true if the capabilities refer to Safari, false otherwise
-
isFirefox
public static boolean isFirefox(org.openqa.selenium.Capabilities capabilities) - Parameters:
capabilities
- The capabilities to check- Returns:
- true if the capabilities refer to Firefox, false otherwise
-
getBrowserIdentifier
Returns a human readable identifier of the given browser. Used for test naming and screenshots- Parameters:
capabilities
- to obtain the browser identifier from- Returns:
- a human readable string describing the capabilities
-
getPlatform
Returns a human readable identifier of the platform described by the given capabilities. Used mainly for screenshots- Parameters:
capabilities
- to obtain the platform from- Returns:
- a human readable string describing the platform
-
setBrowserFactory
Sets new BrowserFactory to generate default DesiredCapabilities for each Browser.
Extend BrowserFactory and override its methods in order to add default version, platform or other capabilities.- Parameters:
browserFactory
- BrowserFactory instance to use to generate default DesiredCapabilities
-
getBrowserFactory
Gets the BrowserFactory used to generate new DesiredCapabilities- Returns:
- BrowserFactory used to generate new DesiredCapabilities
-