public interface BrowserContext extends org.openqa.selenium.SearchContext, PropertySource, DataSource, org.openqa.selenium.internal.WrapsDriver
Browser
and adds Browser specific methods directly in scope of
Page, BrowserElement and Logic.| Modifier and Type | Method and Description |
|---|---|
default void |
assertAt(Class<?> page)
Asserts that actual page is a given class.
|
default void |
checkIfPresent(org.openqa.selenium.WebElement element)
Checks if element exists on actual page.
|
default <T extends BrowserElement> |
constructBrowserElement(Class<T> element,
org.openqa.selenium.WebElement webElement,
boolean optional)
Construct element defined by class.
|
default <T extends BrowserEvent> |
constructEvent(Class<T> eventCls)
Construct event defined by class.
|
default <T extends Logic> |
constructLogic(Class<T> logic)
Construct logic defined by class.
|
default <T extends Page> |
constructPage(Class<T> page)
Construct page defined by class.
|
default org.openqa.selenium.support.pagefactory.ElementLocator |
createElementLocator(org.openqa.selenium.By by)
Creates
ElementLocator used to locate element. |
default org.openqa.selenium.support.pagefactory.ElementLocator |
createElementLocator(org.openqa.selenium.By by,
boolean lookupCached)
Creates
ElementLocator used to locate element. |
default org.openqa.selenium.support.pagefactory.ElementLocator |
createElementLocator(Field field)
Creates
ElementLocator used to locate element. |
default List<BrowserElement> |
find(BrowserContext context,
org.openqa.selenium.By by)
Find all elements within the given context using the given mechanism.
|
default <T extends BrowserElement> |
find(BrowserContext context,
org.openqa.selenium.By by,
Class<T> elementCls)
Find all elements within the given context using the given mechanism
as instances of the given
BrowserElement or its subclass. |
default List<BrowserElement> |
find(org.openqa.selenium.By by)
Find all elements within the current context using the given mechanism.
|
default <T extends BrowserElement> |
find(org.openqa.selenium.By by,
Class<T> elementCls)
Find all elements within the current context using the given mechanism
as instances of the given
BrowserElement or its subclass. |
default BrowserElement |
findOne(BrowserContext context,
org.openqa.selenium.By by)
Find the first element within the given context using the given mechanism.
|
default <T extends BrowserElement> |
findOne(BrowserContext context,
org.openqa.selenium.By by,
Class<T> elementCls)
Find the first element within the given context using the given mechanism
as instance of the given
BrowserElement or its subclass. |
default <T extends BrowserElement> |
findOne(BrowserContext context,
org.openqa.selenium.By by,
Class<T> elementCls,
boolean optional)
Find the first element within the given context using the given mechanism
as instance of the given
BrowserElement or its subclass. |
default BrowserElement |
findOne(org.openqa.selenium.By by)
Find the first element within the current context using the given mechanism.
|
default <T extends BrowserElement> |
findOne(org.openqa.selenium.By by,
Class<T> elementCls)
Find the first element within the current context using the given mechanism
as instance of the given
BrowserElement or its subclass. |
default BrowserElement |
findOneOptional(BrowserContext context,
org.openqa.selenium.By by)
Find the first element within the given context using the given mechanism.
|
default <T extends BrowserElement> |
findOneOptional(BrowserContext context,
org.openqa.selenium.By by,
Class<T> elementCls)
Find the first element within the given context using the given mechanism
as instance of the given
BrowserElement or its subclass. |
default BrowserElement |
findOneOptional(org.openqa.selenium.By by)
Find the first element within the current context using the given mechanism.
|
default <T extends BrowserElement> |
findOneOptional(org.openqa.selenium.By by,
Class<T> elementCls)
Find the first element within the current context using the given mechanism
as instance of the given
BrowserElement or its subclass. |
Browser |
getBrowser()
Returns
Browser instance. |
default <T> T |
getBrowser(Class<T> browser)
Returns
Browser instance casted to specific type. |
default BrowserConfiguration |
getConfiguration()
Returns
BrowserConfiguration instance. |
default <T> T |
getConfiguration(Class<T> configuration)
Returns
BrowserConfiguration instance casted to specific type. |
BrowserContext |
getContext()
Returns parent
BrowserContext instance. |
default <T> T |
getContext(Class<T> context)
Returns parent
BrowserContext instance casted to specific type. |
default Map<String,Object> |
getDataHolder()
Returns map which holds data.
|
default org.openqa.selenium.WebDriver |
getDriver()
Returns wrapped
WebDriver instance. |
default <T> T |
getDriver(Class<T> driver)
Returns wrapped
WebDriver instance casted to specific type. |
default Page |
getPage()
Returns actual page or null if browser
has no page initiated.
|
default <T> T |
getPage(Class<T> page)
Returns actual page casted to given
type or null if browser has no page
initiated.
|
default String |
getProperty(String key)
Returns property as
String. |
default BrowserUtils |
getUtils()
Returns browser utilities instance.
|
default double |
getWaitRetryInterval()
Returns default wait retry interval.
|
default double |
getWaitTimeout()
Returns default wait timeout.
|
default org.openqa.selenium.WebDriver |
getWrappedDriver() |
default <T extends Page> |
goTo(Class<T> page)
Go to page defined by class.
|
default <T extends Page> |
goTo(T page)
Go to already constructed page.
|
default <T extends Page> |
goToSafely(Class<T> page)
Safely go to page defined by class.
|
default <T extends Page> |
goToSafely(T page)
Safely go to already constructed page.
|
default void |
goToUrl(String url)
Go to specific URL.
|
default <T extends BrowserElement> |
initBrowserElement(Class<T> element,
org.openqa.selenium.WebElement webElement,
boolean optional)
Initialize element defined by class.
|
default <T extends BrowserElement> |
initBrowserElement(T element)
Initialize already constructed element.
|
default void |
initElements()
Initialize elements annotated with
FindBy
and similar annotations. |
default <T extends Logic> |
initLogic(Class<T> logic)
Initialize logic defined by class.
|
default <T extends Logic> |
initLogic(T logic)
Initialize logic defined by class.
|
default Page |
initOnePage(Object... pages)
Initialize first of matching page.
|
default Page |
initOnePageSafely(Object... pages)
Safely initialize first of matching page.
|
default <T extends Page> |
initPage(Class<T> page)
Initialize page defined by class.
|
default <T extends Page> |
initPage(T page)
Initialize already constructed page.
|
default <T extends Page> |
initPageSafely(Class<T> page)
Safely initialize page defined by class.
|
default <T extends Page> |
initPageSafely(T page)
Safely initialize already constructed page.
|
default boolean |
isAt(Class<?> page)
Check if actual page is a given class.
|
default boolean |
isNotPresent(org.openqa.selenium.WebElement element)
Returns true if element does not exists on actual page.
|
default boolean |
isPresent(org.openqa.selenium.WebElement element)
Returns true if element exists on actual page.
|
default void |
report(String label)
Triggers
OnReportEvent with given label. |
default void |
saveFile(byte[] bytes,
String name,
String extension)
Saves bytes into named file with extension.
|
default void |
saveFile(File file,
String name,
String extension)
Saves file into named file with extension.
|
default void |
saveFile(String content,
String name,
String extension)
Saves string into named file with extension.
|
default void |
setPage(Page page)
Sets actual browser page.
|
default void |
triggerEvent(BrowserEvent event)
Triggers
BrowserEvent. |
default BrowserContextWait |
waiting()
Constructs new wait instance using default
waiting settings.
|
default BrowserContextWait |
waiting(org.openqa.selenium.support.ui.Clock clock,
org.openqa.selenium.support.ui.Sleeper sleeper,
double timeout,
double retryInterval)
Constructs new wait instance using default
waiting settings with specific clock to use
when measuring the timeout, specific sleeper to use
to put the thread to sleep between evaluation loops,
specific timeout in seconds and retry interval in seconds.
|
default BrowserContextWait |
waiting(double timeout)
Constructs new wait instance using default
waiting settings with specific timeout in seconds.
|
default BrowserContextWait |
waiting(double timeout,
double retryInterval)
Constructs new wait instance using default
waiting settings with specific timeout in seconds
and retry interval in seconds.
|
castString, getProperty, getProperty, getPropertyaddData, getData, removeDataBrowserContext getContext()
BrowserContext instance.default <T> T getContext(Class<T> context)
BrowserContext instance casted to specific type.default <T> T getBrowser(Class<T> browser)
Browser instance casted to specific type.default BrowserConfiguration getConfiguration()
BrowserConfiguration instance.default <T> T getConfiguration(Class<T> configuration)
BrowserConfiguration instance casted to specific type.default org.openqa.selenium.WebDriver getDriver()
WebDriver instance.default <T> T getDriver(Class<T> driver)
WebDriver instance casted to specific type.default Page getPage()
default <T> T getPage(Class<T> page)
page - The class to cast the page todefault void setPage(Page page)
page - The page to setdefault void goToUrl(String url)
url - The URL to go todefault double getWaitTimeout()
default double getWaitRetryInterval()
default BrowserContextWait waiting(org.openqa.selenium.support.ui.Clock clock, org.openqa.selenium.support.ui.Sleeper sleeper, double timeout, double retryInterval)
clock - The clock to use when measuring the timeout.sleeper - Used to put the thread to sleep between evaluation loops.timeout - The timeout before waiting ends.retryInterval - The retry interval for delays between condition check.default BrowserContextWait waiting(double timeout, double retryInterval)
default BrowserContextWait waiting(double timeout)
default BrowserContextWait waiting()
default boolean isAt(Class<?> page)
page - The class to check the page againstdefault void assertAt(Class<?> page)
AssertionError if condition did not
pass.page - The class to check the page againstdefault <T extends Page> T goToSafely(Class<T> page)
page - The page class to go todefault <T extends Page> T goToSafely(T page)
page - The page instance to go todefault <T extends Page> T initPageSafely(Class<T> page)
page - The page class to initializedefault <T extends Page> T initPageSafely(T page)
page - The page instance to initializedefault Page initOnePageSafely(Object... pages)
Page instances.
It iterates over all pages and tries to initialize
and verify them. First verified page is returned.
If none of the pages is verified null is returned.pages - The page classes or pages to initializedefault <T extends Page> T goTo(Class<T> page)
page - The page class to go toVerificationException - if page verification did not pass
after initializationdefault <T extends Page> T goTo(T page)
page - The page instance to go toVerificationException - if page verification did not pass
after initializationdefault <T extends Page> T initPage(Class<T> page)
page - The page class to initializeVerificationException - if page verification did not pass
after initializationdefault <T extends Page> T initPage(T page)
page - The page instance to initializeVerificationException - if page verification did not pass
after initializationdefault Page initOnePage(Object... pages)
Page instances.
It iterates over all pages and tries to initialize
and verify them. First verified page is returned.
If none of the pages is verified VerificationException
is thrown.pages - The page classes or pages to initializeVerificationException - if none of pages did not pass
verification after initializationdefault <T extends Page> T constructPage(Class<T> page)
page - The page class to constructdefault <T extends BrowserElement> T initBrowserElement(T element)
element - The element instance to initializedefault <T extends BrowserElement> T initBrowserElement(Class<T> element, org.openqa.selenium.WebElement webElement, boolean optional)
element - The element class to initializewebElement - The web element to wrapoptional - Is element optionaldefault <T extends BrowserElement> T constructBrowserElement(Class<T> element, org.openqa.selenium.WebElement webElement, boolean optional)
element - The element class to constructwebElement - The web element to wrapoptional - Is element optionaldefault <T extends Logic> T initLogic(T logic)
logic - The logic instance to initializedefault <T extends Logic> T initLogic(Class<T> logic)
logic - The logic class to initializedefault <T extends Logic> T constructLogic(Class<T> logic)
logic - The logic class to constructdefault void initElements()
FindBy
and similar annotations.default void checkIfPresent(org.openqa.selenium.WebElement element)
throws org.openqa.selenium.NoSuchElementException
NoSuchElementException.element - The element to testorg.openqa.selenium.NoSuchElementException - if element is not presentdefault boolean isPresent(org.openqa.selenium.WebElement element)
isNotPresent(WebElement).element - The element to testtrue if element is presentdefault boolean isNotPresent(org.openqa.selenium.WebElement element)
isPresent(WebElement).element - The element to testtrue if element is not presentdefault void report(String label)
OnReportEvent with given label.label - The report labeldefault void triggerEvent(BrowserEvent event)
BrowserEvent.event - The triggered eventdefault <T extends BrowserEvent> T constructEvent(Class<T> eventCls)
eventCls - The event class to constructdefault void saveFile(String content, String name, String extension)
Browser.getFilePath(String, String).
If Browser.isReported() is false
no file is saved.content - The string content to save.name - The file name without extension.extension - The file extension.default void saveFile(byte[] bytes,
String name,
String extension)
Browser.getFilePath(String, String).
If Browser.isReported() is false
no file is saved.bytes - The bytes to save.name - The file name without extension.extension - The file extension.default void saveFile(File file, String name, String extension)
Browser.getFilePath(String, String).
If Browser.isReported() is false
no file is saved.file - The file to save.name - The file name without extension.extension - The file extension.default BrowserUtils getUtils()
default List<BrowserElement> find(org.openqa.selenium.By by)
by - The locating mechanism to useBrowserElements, or an empty list if nothing matchesdefault List<BrowserElement> find(BrowserContext context, org.openqa.selenium.By by)
context - The browser context to search inby - The locating mechanism to useBrowserElements, or an empty list if nothing matchesdefault <T extends BrowserElement> List<T> find(org.openqa.selenium.By by, Class<T> elementCls)
BrowserElement or its subclass.by - The locating mechanism to useelementCls - The element classBrowserElements as instances of the given
BrowserElement or its subclass, or an empty list if nothing matchesdefault <T extends BrowserElement> List<T> find(BrowserContext context, org.openqa.selenium.By by, Class<T> elementCls)
BrowserElement or its subclass.context - The browser context to search inby - The locating mechanism to useelementCls - The element classBrowserElements as instances of the given
BrowserElement or its subclass, or an empty list if nothing matchesdefault BrowserElement findOne(org.openqa.selenium.By by)
by - The locating mechanismorg.openqa.selenium.NoSuchElementException - If no matching elements are founddefault BrowserElement findOne(BrowserContext context, org.openqa.selenium.By by)
context - The browser context to search inby - The locating mechanismorg.openqa.selenium.NoSuchElementException - If no matching elements are founddefault <T extends BrowserElement> T findOne(org.openqa.selenium.By by, Class<T> elementCls)
BrowserElement or its subclass.by - The locating mechanismelementCls - The element classBrowserElement or its subclassorg.openqa.selenium.NoSuchElementException - If no matching elements are founddefault <T extends BrowserElement> T findOne(BrowserContext context, org.openqa.selenium.By by, Class<T> elementCls)
BrowserElement or its subclass.context - The browser context to search inby - The locating mechanismelementCls - The element classBrowserElement or its subclassorg.openqa.selenium.NoSuchElementException - If no matching elements are founddefault <T extends BrowserElement> T findOne(BrowserContext context, org.openqa.selenium.By by, Class<T> elementCls, boolean optional)
BrowserElement or its subclass.
If optional is true and no matching elements are found null
is returned instead of throwing NoSuchElementException.context - The browser context to search inby - The locating mechanismelementCls - The element classoptional - true for returning null instead of throwing
NoSuchElementException if no matching elements are foundBrowserElement or its subclassorg.openqa.selenium.NoSuchElementException - If no matching elements are found and optional is falsedefault BrowserElement findOneOptional(org.openqa.selenium.By by)
null is returned.by - The locating mechanismdefault BrowserElement findOneOptional(BrowserContext context, org.openqa.selenium.By by)
null is returned.context - The browser context to search inby - The locating mechanismdefault <T extends BrowserElement> T findOneOptional(org.openqa.selenium.By by, Class<T> elementCls)
BrowserElement or its subclass.
If no matching elements are found null is returned.by - The locating mechanismelementCls - The element classdefault <T extends BrowserElement> T findOneOptional(BrowserContext context, org.openqa.selenium.By by, Class<T> elementCls)
BrowserElement or its subclass.
If no matching elements are found null is returned.context - The browser context to search inby - The locating mechanismelementCls - The element classdefault org.openqa.selenium.support.pagefactory.ElementLocator createElementLocator(Field field)
ElementLocator used to locate element.
It uses FindBy and similar annotations assigned
to the given field to create By locating mechanism.field - The field used as locator sourcedefault org.openqa.selenium.support.pagefactory.ElementLocator createElementLocator(org.openqa.selenium.By by)
ElementLocator used to locate element.
It uses the given By locating mechanism.by - The locating mechanismdefault org.openqa.selenium.support.pagefactory.ElementLocator createElementLocator(org.openqa.selenium.By by,
boolean lookupCached)
ElementLocator used to locate element.
It uses the given By locating mechanism.
Set lookupCached to true return element
from cache on further calls.by - The locating mechanismlookupCached - if lookup is cacheddefault org.openqa.selenium.WebDriver getWrappedDriver()
getWrappedDriver in interface org.openqa.selenium.internal.WrapsDriverdefault Map<String,Object> getDataHolder()
DataSourcegetDataHolder in interface DataSourcedefault String getProperty(String key)
PropertySourceString.getProperty in interface PropertySourcekey - The property key.Copyright © 2016 Etnetera a.s.. All rights reserved.