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 StringgetAsJson(org.openqa.selenium.WebDriver webClient) Return plain json.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 booleanisWindowStillOpen(org.openqa.selenium.WebDriver webClient, String popupHandle2) Check if the window for a given handle is still openstatic voidscrollTo(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element) Scroll to an element so it is visible at the top on topstatic voidscrollTo(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 fieldstatic booleanwebResponseIsJson(org.openqa.selenium.WebDriver webClient) Überprüft die Webantwort, ob der http Statuscode 200 ist und die Antwort im JSON-Format vorliegt.
-
Method Details
-
getAsJson
Return plain json. Bo checks are performed!!!! -
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- theWebDriverto 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- theWebDriverto 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- theWebDriverto uselinkElement- the link on the page to the PDFexpectedFileName-- Returns:
- the PDF as byte array
-
isWindowStillOpen
public static boolean isWindowStillOpen(org.openqa.selenium.WebDriver webClient, String popupHandle2) Check if the window for a given handle is still open -
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
-
webResponseIsJson
public static boolean webResponseIsJson(org.openqa.selenium.WebDriver webClient) Überprüft die Webantwort, ob der http Statuscode 200 ist und die Antwort im JSON-Format vorliegt.- Parameters:
webResponse-- Returns:
- true wenn HHTP code 200 und Antwortinhalt application/json ist, sonst false.
-