public class BrowserElement extends Object implements BrowserContext, org.openqa.selenium.WebElement, org.openqa.selenium.internal.WrapsElement, org.openqa.selenium.internal.WrapsDriver, org.openqa.selenium.internal.Locatable
WebElement and holds BrowserContext
with WebDriver. Allows to check if element is present
or not and can be optional. Subclasses can override initPresent()
method to add some specific behavior.| Modifier and Type | Field and Description |
|---|---|
protected BrowserContext |
context |
protected boolean |
optional |
protected boolean |
present |
protected org.openqa.selenium.WebElement |
webElement |
| Constructor and Description |
|---|
BrowserElement() |
| Modifier and Type | Method and Description |
|---|---|
void |
blur()
Loose focus from element.
|
void |
checkIfPresent() |
void |
clear() |
void |
click() |
org.openqa.selenium.WebElement |
findElement(org.openqa.selenium.By by) |
List<org.openqa.selenium.WebElement> |
findElements(org.openqa.selenium.By by) |
String |
getAttribute(String name) |
Browser |
getBrowser()
Returns
Browser instance. |
List<String> |
getClasses()
Returns the class names present on element.
|
BrowserContext |
getContext()
Returns parent
BrowserContext instance. |
org.openqa.selenium.interactions.internal.Coordinates |
getCoordinates() |
String |
getCssValue(String propertyName) |
org.openqa.selenium.Point |
getLocation() |
<X> X |
getScreenshotAs(org.openqa.selenium.OutputType<X> target) |
org.openqa.selenium.Dimension |
getSize() |
String |
getTagName() |
String |
getText() |
double |
getWaitRetryInterval()
Returns default wait retry interval.
|
double |
getWaitTimeout()
Returns default wait timeout.
|
org.openqa.selenium.WebElement |
getWebElement() |
org.openqa.selenium.WebElement |
getWrappedElement() |
boolean |
hasClass(String className)
Returns true if element has the given class.
|
BrowserElement |
init() |
protected void |
initPresent()
Called when
BrowserElement is initiated
and is present or before getting wrapped WebElement
which was not present and is present now. |
boolean |
isDisplayed() |
boolean |
isEnabled() |
boolean |
isNotPresent() |
boolean |
isOptional() |
boolean |
isPresent() |
boolean |
isSelected() |
void |
sendKeys(CharSequence... keysToSend) |
void |
submit() |
BrowserElement |
with(BrowserContext context,
org.openqa.selenium.WebElement webElement,
boolean optional) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitassertAt, checkIfPresent, constructBrowserElement, constructEvent, constructLogic, constructPage, createElementLocator, createElementLocator, createElementLocator, find, find, find, find, findOne, findOne, findOne, findOne, findOne, findOneOptional, findOneOptional, findOneOptional, findOneOptional, getBrowser, getConfiguration, getConfiguration, getContext, getDataHolder, getDriver, getDriver, getPage, getPage, getProperty, getUtils, getWrappedDriver, goTo, goTo, goToSafely, goToSafely, goToUrl, initBrowserElement, initBrowserElement, initElements, initLogic, initLogic, initOnePage, initOnePageSafely, initPage, initPage, initPageSafely, initPageSafely, isAt, isNotPresent, isPresent, report, saveFile, saveFile, saveFile, setPage, triggerEvent, waiting, waiting, waiting, waitingcastString, getProperty, getProperty, getPropertyaddData, getData, removeDataprotected BrowserContext context
protected org.openqa.selenium.WebElement webElement
protected boolean optional
protected boolean present
public BrowserElement with(BrowserContext context, org.openqa.selenium.WebElement webElement, boolean optional)
public org.openqa.selenium.WebElement getWebElement()
public boolean isOptional()
public BrowserContext getContext()
BrowserContextBrowserContext instance.getContext in interface BrowserContextpublic final BrowserElement init()
protected void initPresent()
BrowserElement is initiated
and is present or before getting wrapped WebElement
which was not present and is present now.public void checkIfPresent()
throws org.openqa.selenium.NoSuchElementException
org.openqa.selenium.NoSuchElementExceptionpublic boolean isPresent()
public boolean isNotPresent()
public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by)
findElements in interface org.openqa.selenium.SearchContextfindElements in interface org.openqa.selenium.WebElementpublic org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)
findElement in interface org.openqa.selenium.SearchContextfindElement in interface org.openqa.selenium.WebElementpublic <X> X getScreenshotAs(org.openqa.selenium.OutputType<X> target)
throws org.openqa.selenium.WebDriverException
getScreenshotAs in interface org.openqa.selenium.TakesScreenshotorg.openqa.selenium.WebDriverExceptionpublic void click()
click in interface org.openqa.selenium.WebElementpublic void submit()
submit in interface org.openqa.selenium.WebElementpublic void sendKeys(CharSequence... keysToSend)
sendKeys in interface org.openqa.selenium.WebElementpublic void clear()
clear in interface org.openqa.selenium.WebElementpublic String getTagName()
getTagName in interface org.openqa.selenium.WebElementpublic String getAttribute(String name)
getAttribute in interface org.openqa.selenium.WebElementpublic boolean isSelected()
isSelected in interface org.openqa.selenium.WebElementpublic boolean isEnabled()
isEnabled in interface org.openqa.selenium.WebElementpublic String getText()
getText in interface org.openqa.selenium.WebElementpublic boolean isDisplayed()
isDisplayed in interface org.openqa.selenium.WebElementpublic org.openqa.selenium.Point getLocation()
getLocation in interface org.openqa.selenium.WebElementpublic org.openqa.selenium.Dimension getSize()
getSize in interface org.openqa.selenium.WebElementpublic String getCssValue(String propertyName)
getCssValue in interface org.openqa.selenium.WebElementpublic org.openqa.selenium.WebElement getWrappedElement()
getWrappedElement in interface org.openqa.selenium.internal.WrapsElementpublic org.openqa.selenium.interactions.internal.Coordinates getCoordinates()
getCoordinates in interface org.openqa.selenium.internal.Locatablepublic Browser getBrowser()
BrowserContextBrowser instance.getBrowser in interface BrowserContextpublic double getWaitTimeout()
BrowserContextgetWaitTimeout in interface BrowserContextpublic double getWaitRetryInterval()
BrowserContextgetWaitRetryInterval in interface BrowserContextpublic void blur()
JavascriptExecutor drivers.
It throws BrowserException if driver is not
implementing JavascriptExecutor.public boolean hasClass(String className)
className - class to check forCopyright © 2016 Etnetera a.s.. All rights reserved.