Class WebDriverFixtures<SELF extends WebDriverFixtures<SELF>>
- java.lang.Object
-
- com.tngtech.jgiven.base.StageBase<SELF>
-
- com.tngtech.jgiven.Stage<SELF>
-
- dev.aherscu.qa.jgiven.commons.utils.StageEx<SELF>
-
- dev.aherscu.qa.jgiven.commons.steps.GenericFixtures<WebDriverScenarioType,SELF>
-
- dev.aherscu.qa.jgiven.webdriver.steps.WebDriverFixtures<SELF>
-
- Type Parameters:
SELF
- the type of the subclass
- All Implemented Interfaces:
dev.aherscu.qa.jgiven.commons.model.ScenarioType<WebDriverScenarioType>
@ThreadSafe public class WebDriverFixtures<SELF extends WebDriverFixtures<SELF>> extends dev.aherscu.qa.jgiven.commons.steps.GenericFixtures<WebDriverScenarioType,SELF>
Generic web driver fixtures. If WebDriver's capabilities containAUTO_QUIT
, then closes the WebDriver by end of scenario.- Author:
- aherscu
-
-
Field Summary
Fields Modifier and Type Field Description static String
AUTO_QUIT
Add to capabilities in order to automatically quit the web driver by end of scenario; value does not matter.protected ThreadLocal<dev.aherscu.qa.jgiven.commons.utils.WebDriverEx>
webDriver
The given Web Driver.
-
Constructor Summary
Constructors Constructor Description WebDriverFixtures()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SELF
a_web_driver(dev.aherscu.qa.jgiven.commons.utils.WebDriverEx webDriver)
Sets a web driver for this scenario.SELF
at(String applicationUrl)
Opens Web application at specified host if not already open.protected SELF
context(Predicate<String> byRule)
Switches to specified Appium context.protected org.openqa.selenium.WebElement
scrollIntoView(org.openqa.selenium.WebElement element)
Scrolls specified element into view.protected dev.aherscu.qa.jgiven.commons.utils.WebDriverEx
thisWebDriver()
-
-
-
Field Detail
-
AUTO_QUIT
public static final String AUTO_QUIT
Add to capabilities in order to automatically quit the web driver by end of scenario; value does not matter.- See Also:
- Constant Field Values
-
webDriver
@ProvidedScenarioState protected final ThreadLocal<dev.aherscu.qa.jgiven.commons.utils.WebDriverEx> webDriver
The given Web Driver.
-
-
Method Detail
-
a_web_driver
@NestedSteps public SELF a_web_driver(dev.aherscu.qa.jgiven.commons.utils.WebDriverEx webDriver)
Sets a web driver for this scenario. If it has has a capability namedAUTO_QUIT
, then it will automatically quit after scenario.- Parameters:
webDriver
- the driver- Returns:
StageBase.self()
- Throws:
NullPointerException
- if the driver reference was null
-
at
public SELF at(String applicationUrl)
Opens Web application at specified host if not already open.- Parameters:
applicationUrl
- the location of the application- Returns:
StageBase.self()
-
context
@Hidden protected SELF context(Predicate<String> byRule)
Switches to specified Appium context.- Parameters:
byRule
- naming rule of Appium context- Returns:
StageBase.self()
- Throws:
org.openqa.selenium.NoSuchContextException
- if no such context exists
-
scrollIntoView
protected org.openqa.selenium.WebElement scrollIntoView(org.openqa.selenium.WebElement element)
Scrolls specified element into view.scrollIntoView
metric will be updated.- Overrides:
scrollIntoView
in classdev.aherscu.qa.jgiven.commons.utils.StageEx<SELF extends WebDriverFixtures<SELF>>
- Parameters:
element
- the element to scroll into view- Returns:
- the element
-
thisWebDriver
protected final dev.aherscu.qa.jgiven.commons.utils.WebDriverEx thisWebDriver()
-
-