Class SeleniumUtils


  • public class SeleniumUtils
    extends Object
    Utilities for Selenium.
    • Method Detail

      • patternMatches

        public static boolean patternMatches​(String pattern,
                                             CharSequence input)
        String-match pattern.
        Parameters:
        pattern - pattern. prefix is "glob:", "regexp:", "regexpi:", or "exact:".
        input - input string.
        Returns:
        true if matched pattern.
      • normalizeSpaces

        public static String normalizeSpaces​(String str)
        Unifty U+0020 and U+00A0, Trim, and compress spaces in string.
        Parameters:
        str - string.
        Returns:
        normalized string.
      • doubleToString

        public static String doubleToString​(double d)
        Stringify the double value. If the double value is mathematically an integer, drop fraction part.
        Parameters:
        d - double value.
        Returns:
        stringified double value.
      • convertToString

        public static <T> String convertToString​(T result)
        Convert to String from the result of execute().
        Type Parameters:
        T - the type of result object.
        Parameters:
        result - the result of execute().
        Returns:
        converted string.
      • isElementNotFound

        public static boolean isElementNotFound​(RuntimeException e)
        Check if Exception type is "element not found".
        Parameters:
        e - RuntimeException
        Returns:
        true if the exception is "element not found".
      • windowMaximize

        public static void windowMaximize​(org.openqa.selenium.WebDriver driver)
        Maximize window with workaround.
        Parameters:
        driver - WebDriver instance.