Class BrowserUtil


  • public class BrowserUtil
    extends Object
    Provides helper method for selecting the browser to run on
    • Constructor Summary

      Constructors 
      Constructor Description
      BrowserUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.openqa.selenium.remote.DesiredCapabilities chrome()
      Gets the capabilities for Chrome
      static org.openqa.selenium.remote.DesiredCapabilities edge()
      Gets the capabilities for Edge
      static org.openqa.selenium.remote.DesiredCapabilities firefox()
      Gets the capabilities for Firefox
      static TestBenchBrowserFactory getBrowserFactory()
      Gets the BrowserFactory used to generate new DesiredCapabilities
      static 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 Safari
    • Constructor Detail

      • BrowserUtil

        public BrowserUtil()
    • Method Detail

      • 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

        public static String getBrowserIdentifier​(org.openqa.selenium.Capabilities capabilities)
        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

        public static String getPlatform​(org.openqa.selenium.Capabilities capabilities)
        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
      • getBrowserFactory

        public static TestBenchBrowserFactory getBrowserFactory()
        Gets the BrowserFactory used to generate new DesiredCapabilities
        Returns:
        BrowserFactory used to generate new DesiredCapabilities