Class WebUtilsSelenium

java.lang.Object
de.frankmuenster.mahoe.utils.WebUtilsSelenium

public final class WebUtilsSelenium extends Object
Utility class for web methods
Author:
Frank Münster
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    getSeleniumPdfAsByteArray(org.openqa.selenium.WebDriver driver, String url)
    Read the account statement PDF into a byte array.
    static byte[]
    getSeleniumPdfAsByteArray(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement linkElement)
    Deprecated.
    from 2.6.2.
    static byte[]
    getSeleniumPdfAsByteArray(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement linkElement, String expectedFileName)
    Read the account statement PDF into a byte array.
    static void
    scrollTo(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element)
    Scroll to an element so it is visible at the top on top
    static void
    scrollTo(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element, boolean scrollTo)
    Scroll to an element so it is visible at scrollTo position
    static org.openqa.selenium.support.ui.ExpectedCondition<Boolean>
    textToBePresentInElement(org.openqa.selenium.WebElement element, String text)
    Waits for a text to be present as part of a field

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getSeleniumPdfAsByteArray

      public static byte[] getSeleniumPdfAsByteArray(org.openqa.selenium.WebDriver driver, String url) throws WebSiteException
      Read the account statement PDF into a byte array.
      Parameters:
      driver - the WebDriver to use
      linkElement - the link on the page to the PDF
      expectedFileName -
      Returns:
      the PDF as byte array
      Throws:
      WebSiteException
    • getSeleniumPdfAsByteArray

      @Deprecated public static byte[] getSeleniumPdfAsByteArray(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement linkElement) throws WebSiteException
      Deprecated.
      from 2.6.2.
      Please replace with {@link getSeleniumPdfAsByteArray(final WebDriver driver, final String url)} to avoid stale elements.
      Read the account statement PDF into a byte array.
      Parameters:
      driver - the WebDriver to use
      linkElement - the link on the page to the PDF
      expectedFileName -
      Returns:
      the PDF as byte array
      Throws:
      WebSiteException
    • getSeleniumPdfAsByteArray

      public static byte[] getSeleniumPdfAsByteArray(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement linkElement, String expectedFileName)
      Read the account statement PDF into a byte array.
      Parameters:
      driver - the WebDriver to use
      linkElement - the link on the page to the PDF
      expectedFileName -
      Returns:
      the PDF as byte array
    • scrollTo

      public static void scrollTo(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element)
      Scroll to an element so it is visible at the top on top
    • scrollTo

      public static void scrollTo(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element, boolean scrollTo)
      Scroll to an element so it is visible at scrollTo position
      Parameters:
      scrollTo - true top of element on top of view area, false bottom of element on bottom of view area
    • textToBePresentInElement

      public static org.openqa.selenium.support.ui.ExpectedCondition<Boolean> textToBePresentInElement(org.openqa.selenium.WebElement element, String text)
      Waits for a text to be present as part of a field
      Parameters:
      element - the element the text should appear
      text - the text to wait for
      Returns:
      true if the text was found, false else