Package de.frankmuenster.mahoe.utils
Class WebUtilsSelenium
java.lang.Object
de.frankmuenster.mahoe.utils.WebUtilsSelenium
Utility class for web methods
- Author:
- Frank Münster
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 topstatic void
scrollTo
(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element, boolean scrollTo) Scroll to an element so it is visible at scrollTo positionstatic 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
-
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
- theWebDriver
to uselinkElement
- the link on the page to the PDFexpectedFileName
-- 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
- theWebDriver
to uselinkElement
- the link on the page to the PDFexpectedFileName
-- 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
- theWebDriver
to uselinkElement
- the link on the page to the PDFexpectedFileName
-- 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 appeartext
- the text to wait for- Returns:
- true if the text was found, false else
-