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 class
protected static final record
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
static final Duration
static final org.openqa.selenium.Dimension
static final String
static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final org.slf4j.Logger
static final org.openqa.selenium.Dimension
static final String
private static final String
private static final String
static final String
private static final String
private static final String
private static final String
static final org.openqa.selenium.Dimension
private static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static org.openqa.selenium.By
byAnchorLink
(String href) protected static void
clickElement
(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element) protected static void
clickVisibleCloseButtons
(org.openqa.selenium.WebDriver driver) protected static void
executeScript
(org.openqa.selenium.WebDriver driver, String js, Object... args) protected static void
executeScriptAsync
(org.openqa.selenium.WebDriver driver, String js, Object... args) protected static org.openqa.selenium.WebElement
findSubmitButton
(org.openqa.selenium.WebDriver driver, String formId) protected static org.openqa.selenium.chrome.ChromeOptions
protected static org.openqa.selenium.chrome.ChromeOptions
protected static org.openqa.selenium.firefox.FirefoxOptions
protected static org.openqa.selenium.firefox.FirefoxOptions
protected static String
getConfigOverrideQueryParam
(com.fasterxml.jackson.databind.JsonNode config) protected static String
getInputValue
(org.openqa.selenium.WebDriver driver, String inputId) protected static String
getNukeUrl
(String url) protected String
protected static Path
getScreenshotPath
(org.openqa.selenium.WebDriver driver, String name) protected static void
navigateToAnchorLink
(org.openqa.selenium.WebDriver driver, String href, org.openqa.selenium.support.ui.FluentWait<org.openqa.selenium.WebDriver> wait) protected static void
navigateToComponent
(String component, org.openqa.selenium.WebDriver driver, org.openqa.selenium.support.ui.FluentWait<org.openqa.selenium.WebDriver> wait) protected static org.openqa.selenium.chrome.ChromeDriver
newChromeDriver
(org.openqa.selenium.chrome.ChromeOptions options) protected static org.openqa.selenium.firefox.FirefoxDriver
newFirefoxDriver
(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.By
newInvalidInputSelector
(String formId) protected void
protected static void
runAndAssertQunit
(org.openqa.selenium.WebDriver driver, int expectedAssertions, Duration timeout, String url) protected static AbstractWebDriver.QunitResult
protected void
runUiTest
(org.openqa.selenium.WebDriver driver, Callable<Void> test, String url, @Nullable org.openqa.selenium.Dimension windowSize) protected static void
scrollTo
(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element) protected static void
setScriptTimeout
(org.openqa.selenium.WebDriver driver, Duration timeout) static void
protected static void
takeQunitFailedScreenshots
(org.openqa.selenium.WebDriver driver, AbstractWebDriver.QunitResult result) protected static void
takeScreenshot
(org.openqa.selenium.WebDriver driver, String name) static void
protected void
windowPost
(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
-
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() -
qunit
-
runAndAssertQunit
-
takeQunitFailedScreenshots
protected static void takeQunitFailedScreenshots(org.openqa.selenium.WebDriver driver, AbstractWebDriver.QunitResult result) -
runQunit
protected static AbstractWebDriver.QunitResult runQunit(org.openqa.selenium.WebDriver driver, int expectedAssertions, Duration timeout) -
runUiTest
-
getNukeUrl
-
getConfigOverrideQueryParam
protected static String getConfigOverrideQueryParam(com.fasterxml.jackson.databind.JsonNode config) throws IOException - Throws:
IOException
-
newFluentWait
protected static org.openqa.selenium.support.ui.FluentWait<org.openqa.selenium.WebDriver> newFluentWait(org.openqa.selenium.WebDriver driver, Duration timeout) -
windowPost
-
getPostMessageOrigin
-
clickElement
protected static void clickElement(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element) -
clickVisibleCloseButtons
protected static void clickVisibleCloseButtons(org.openqa.selenium.WebDriver driver) -
findSubmitButton
protected static org.openqa.selenium.WebElement findSubmitButton(org.openqa.selenium.WebDriver driver, String formId) -
getInputValue
-
byAnchorLink
-
newInvalidInputSelector
-
scrollTo
protected static void scrollTo(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement element) -
setScriptTimeout
-
takeScreenshot
-
getScreenshotPath
-
executeScript
-
executeScriptAsync
-