Package ch.rswk.util.web.test
Class AbstractWebDriver
java.lang.Object
ch.rswk.util.web.test.AbstractWebDriver
- Direct Known Subclasses:
WebDriverTest,WebDriverTest,WebDriverTest
AbstractWebDriver contains common setup and utility functions for Selenium WebDrvier
based testing, using Chrome and Firefox browsers.
See ChromeDriver and GeckoDriver.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classprotected static final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringstatic final Durationstatic final org.openqa.selenium.Dimensionstatic final Stringstatic final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final org.slf4j.Loggerstatic final org.openqa.selenium.Dimensionstatic final Stringprivate static final Stringprivate static final Stringstatic final Stringprivate static final Stringprivate static final Stringprivate static final Stringstatic final org.openqa.selenium.Dimensionprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static org.openqa.selenium.BybyAnchorLink(String href) protected static voidclickElement(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element) protected static voidclickVisibleCloseButtons(org.openqa.selenium.WebDriver driver) protected static voidexecuteScript(org.openqa.selenium.WebDriver driver, String js, Object... args) protected static voidexecuteScriptAsync(org.openqa.selenium.WebDriver driver, String js, Object... args) protected static org.openqa.selenium.WebElementfindSubmitButton(org.openqa.selenium.WebDriver driver, String formId) protected static org.openqa.selenium.chrome.ChromeOptionsprotected static org.openqa.selenium.chrome.ChromeOptionsprotected static org.openqa.selenium.firefox.FirefoxOptionsprotected static org.openqa.selenium.firefox.FirefoxOptionsprotected static StringgetConfigOverrideQueryParam(com.fasterxml.jackson.databind.JsonNode config) protected static StringgetInputValue(org.openqa.selenium.WebDriver driver, String inputId) protected static StringgetNukeUrl(String url) protected Stringprotected static PathgetScreenshotPath(org.openqa.selenium.WebDriver driver, String name) protected static voidnavigateToAnchorLink(org.openqa.selenium.WebDriver driver, String href, org.openqa.selenium.support.ui.FluentWait<org.openqa.selenium.WebDriver> wait) protected static voidnavigateToComponent(String component, org.openqa.selenium.WebDriver driver, org.openqa.selenium.support.ui.FluentWait<org.openqa.selenium.WebDriver> wait) protected static org.openqa.selenium.chrome.ChromeDrivernewChromeDriver(org.openqa.selenium.chrome.ChromeOptions options) protected static org.openqa.selenium.firefox.FirefoxDrivernewFirefoxDriver(org.openqa.selenium.firefox.FirefoxOptions options) protected static org.openqa.selenium.support.ui.FluentWait<org.openqa.selenium.WebDriver> newFluentWait(org.openqa.selenium.WebDriver driver, Duration timeout) protected static org.openqa.selenium.BynewInvalidInputSelector(String formId) protected voidprotected static voidrunAndAssertQunit(org.openqa.selenium.WebDriver driver, int expectedAssertions, Duration timeout, String url) protected static AbstractWebDriver.QunitResultprotected voidrunUiTest(org.openqa.selenium.WebDriver driver, Callable<Void> test, String url, @Nullable org.openqa.selenium.Dimension windowSize) protected static voidscrollTo(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element) protected static voidsetScriptTimeout(org.openqa.selenium.WebDriver driver, Duration timeout) static voidprotected static voidtakeQunitFailedScreenshots(org.openqa.selenium.WebDriver driver, AbstractWebDriver.QunitResult result) protected static voidtakeScreenshot(org.openqa.selenium.WebDriver driver, String name) static voidprotected voidwindowPost(org.openqa.selenium.WebDriver driver, String jsObject)
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
DEFAULT_TIMEOUT
-
DESKTOP_DIMENSIONS
public static final org.openqa.selenium.Dimension DESKTOP_DIMENSIONS -
DRIVER_CHROME
- See Also:
-
DRIVER_FIREFOX
- See Also:
-
MOBILE_DIMENSIONS
public static final org.openqa.selenium.Dimension MOBILE_DIMENSIONS -
NUKE_PATH
- See Also:
-
QUNIT_HTML
- See Also:
-
TABLET_DIMENSIONS
public static final org.openqa.selenium.Dimension TABLET_DIMENSIONS -
ANCHOR_LINK_SELECTOR_FORMAT
- See Also:
-
CHROME_DRIVER_NIX
- See Also:
-
CHROME_DRIVER_WIN
- See Also:
-
CHROME_NIX
- See Also:
-
CHROME_WIN
- See Also:
-
CLOSE_BUTTON_SELECTOR
- See Also:
-
CONFIG_OVERRIDE_QUERY_PARAM
- See Also:
-
ELEMENT_CLICK_JS
- See Also:
-
FIREFOX_DRIVER_NIX
- See Also:
-
FIREFOX_DRIVER_WIN
- See Also:
-
FIREFOX_NIX
- See Also:
-
FIREFOX_WIN
- See Also:
-
FORM_INVALID_SELECTOR_FORMAT
- See Also:
-
HEADLESS_OPTION_VAR
- See Also:
-
POST_MESSAGE_FORMAT
- See Also:
-
QUNIT_FAIL_SCREENSHOT_FORMAT
- See Also:
-
REMOTE_OPTION_VAR
- See Also:
-
SCREENSHOT_PATH_FORMAT
- See Also:
-
SUBMIT_BUTTON_SELECTOR_FORMAT
- See Also:
-
TOOL_DIR
-
CHROME_DIR
-
FIREFOX_DIR
-
CHROME_DRIVER
-
FIREFOX_DRIVER
-
drivers
-
-
Constructor Details
-
AbstractWebDriver
public AbstractWebDriver()
-
-
Method Details
-
clickElement
protected static void clickElement(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element) -
executeScript
-
clickVisibleCloseButtons
protected static void clickVisibleCloseButtons(org.openqa.selenium.WebDriver driver) -
executeScriptAsync
-
findSubmitButton
protected static org.openqa.selenium.WebElement findSubmitButton(org.openqa.selenium.WebDriver driver, String formId) -
getConfigOverrideQueryParam
protected static String getConfigOverrideQueryParam(com.fasterxml.jackson.databind.JsonNode config) throws IOException - Throws:
IOException
-
getInputValue
-
byAnchorLink
-
newFluentWait
protected static org.openqa.selenium.support.ui.FluentWait<org.openqa.selenium.WebDriver> newFluentWait(org.openqa.selenium.WebDriver driver, Duration timeout) -
newInvalidInputSelector
-
qunit
-
runAndAssertQunit
-
runQunit
protected static AbstractWebDriver.QunitResult runQunit(org.openqa.selenium.WebDriver driver, int expectedAssertions, Duration timeout) -
runUiTest
-
takeScreenshot
-
getScreenshotPath
-
getNukeUrl
-
scrollTo
protected static void scrollTo(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element) -
setScriptTimeout
-
setupDrivers
@BeforeAll public static void setupDrivers() -
forgeChromeRemoteOptions
protected static org.openqa.selenium.chrome.ChromeOptions forgeChromeRemoteOptions() -
forgeFirefoxRemoteOptions
protected static org.openqa.selenium.firefox.FirefoxOptions forgeFirefoxRemoteOptions() -
newChromeDriver
protected static org.openqa.selenium.chrome.ChromeDriver newChromeDriver(org.openqa.selenium.chrome.ChromeOptions options) -
forgeChromeOptions
protected static org.openqa.selenium.chrome.ChromeOptions forgeChromeOptions() -
newFirefoxDriver
protected static org.openqa.selenium.firefox.FirefoxDriver newFirefoxDriver(org.openqa.selenium.firefox.FirefoxOptions options) -
forgeFirefoxOptions
protected static org.openqa.selenium.firefox.FirefoxOptions forgeFirefoxOptions() -
teardownDrivers
@AfterAll public static void teardownDrivers() -
takeQunitFailedScreenshots
protected static void takeQunitFailedScreenshots(org.openqa.selenium.WebDriver driver, AbstractWebDriver.QunitResult result) -
windowPost
-
getPostMessageOrigin
-