public class Element extends Object implements IElement
| Modifier and Type | Class and Description |
|---|---|
protected static class |
Element.HIGHLIGHT_MODES |
| Constructor and Description |
|---|
Element(org.openqa.selenium.By locator) |
Element(String locator) |
| Modifier and Type | Method and Description |
|---|---|
void |
eval(String javascript)
Executes JavaScript code on the current element in the current frame or
window.
|
protected org.openqa.selenium.WebElement |
findElement()
Find the element using xpath, id, name, class name or tag name
|
void |
fireEvent(String event)
Fires a javascript event on a web element
|
void |
focusOn()
Focus on this element
|
String |
getAttribute(String attributeName)
Implementing this method would allow for getting an attribute of an
element
|
org.openqa.selenium.By |
getByLocator()
Implementing this method would allow for obtaining the XPath, ID, name,
CSS Selector, class name, or tag name to the element as By-Object.
|
String[] |
getChildNodesValuesText()
Returns the text contained in the child nodes of the current element
|
String |
getCssValue(String propertyName)
Implementing this method would allow for getting the CSS value given the
properties name
|
ExtWebDriver |
getGUIDriver()
Get the WebDriver object to interact with the UI elements
|
String |
getInnerHTML()
Returns inner HTML of the element
|
int |
getLocationX()
Implementing this method would allow for obtaining the X-coordinate of
the element
|
int |
getLocationY()
Implementing this method would allow for obtaining the Y-coordinate of
the element
|
String |
getLocator()
Implementing this method would allow for obtaining the XPath, ID, name,
CSS Selector, class name, or tag name to the element
|
String |
getText()
Implementing this method would allow for obtaining the text of the
Element
|
org.openqa.selenium.WebElement |
getWebElement()
Implementing this method would allow for getting this element as a
WebElement
|
boolean |
hasText(String text)
Implementing this method would allow for checking to see if the element's
text contains a specific substring
|
void |
highlight()
highlight an element for the FIND mode
|
void |
highlight(Element.HIGHLIGHT_MODES mode)
Find the current element and highlight it according to the mode
If mode is NONE, do nothing
|
void |
highlight(String colorMode)
Implementing this method would allow for highlighting this element a
specific color
|
boolean |
isAttributePresent(String attributeName)
Implementing this method would allow for checking if the element has a
specific attribute
|
boolean |
isElementNotPresent()
Implementing this method would allow for checking if an element is Not
present
|
boolean |
isElementNotPresent(long timeout)
Implementing this method would allow for checking if an element is Not
present within [timeout] milliseconds
|
boolean |
isElementPresent()
Implementing this method would allow for checking if an element is
present or not
|
boolean |
isElementPresent(boolean isJavaXPath)
Implementing this method would allow for checking if an element is
present or not
|
boolean |
isElementPresent(long timeout)
Implementing this method would allow for checking if an element is
present or not
|
boolean |
isElementVisible()
Implementing this method would allow for checking if an element is
visible or not
|
boolean |
isElementVisible(long timeout)
Implementing this method would allow for checking if an element is
visible or not within a designated length of time
|
boolean |
isEnabled()
Returns true if the element is enabled.
|
boolean |
isWithinBoundsOfWindow()
Determine if the element is within the bounds of the window
|
void |
scrollTo()
Scroll to this element
|
void |
setGUIDriver(ExtWebDriver guiDriver)
Tell Selenium to use the provided WebDriver instance
|
void |
waitForAttribute(String attributeName,
String pattern)
Waits for specific attribute value o match specific pattern within period
of maxRequestTimeout
|
void |
waitForAttribute(String attributeName,
String pattern,
long timeout)
Waits for specific attribute value to match specific pattern within
period of specified timeout
|
void |
waitForAttributeEqualTo(String attributeName,
String attributeValue)
Implementing this method would allow for keeping the test from
progressing until an element's attribute has the desired value
|
void |
waitForAttributeEqualTo(String attributeName,
String attributeValue,
long timeout)
Implementing this method would allow for keeping the test from
progressing until an element's attribute has the desired value by the
specified amount of time
|
void |
waitForAttributeNotEqualTo(String attributeName,
String attributeValue)
Implementing this method would allow for keeping the test from
progressing until an element's attribute no longer has the desired value
|
void |
waitForAttributeNotEqualTo(String attributeName,
String attributeValue,
long timeout)
Implementing this method would allow for keeping the test from
progressing until an element's attribute no longer has the desired value
by the specified amount of time
|
protected void |
waitForCommand(WaitForConditionTimer.ITimerCallback callback,
long timeout)
wait for timeout amount of time
|
void |
waitForElementNotPresent()
Implementing this method would allow for the test to wait until the
element is no longer present before progressing
|
void |
waitForElementNotPresent(long time)
Implementing this method would allow for the test to wait a designated
length of time until the element is no longer present before progressing
|
void |
waitForElementPresent()
Implementing this method would allow for the test to wait until the
element is present before progressing
|
void |
waitForElementPresent(long time)
Implementing this method would allow for the test to wait a designated
length of time until the element is present before progressing
|
void |
waitForEnabled()
Waits for element to be enabled within period of maxRequestTimeout
|
void |
waitForEnabled(long time)
Waits for element to be enabled within period of specified time
|
void |
waitForNotAttribute(String attributeName,
String pattern)
Waits for specific attribute value to not match specific pattern within
period of maxRequestTimeout
|
void |
waitForNotAttribute(String attributeName,
String pattern,
long timeout)
Waits for specific attribute value not match specific pattern within
period of specified timeout
|
void |
waitForNotVisible()
Implementing this method would allow for the test to wait until the
element is no longer visible before progressing
|
void |
waitForNotVisible(long time)
Waits for specific element at locator to be not visible within period of
specified time
|
void |
waitForText()
Implementing this method would allow for keeping the test from
progressing until an element has text
|
void |
waitForText(long time)
Implementing this method would allow for keeping the test from
progressing until an element has text
|
void |
waitForVisible()
Implementing this method would allow for the test to wait until the
element is visible before progressing
|
void |
waitForVisible(long time)
Waits for specific element at locator to be visible within period of
specified time
|
public Element(String locator)
locator - XPath, ID, name, CSS Selector, class name, or tag namepublic Element(org.openqa.selenium.By locator)
locator - a By which defines this element by its first matchpublic String getLocator()
IElementgetLocator in interface IElementpublic org.openqa.selenium.By getByLocator()
IElementgetByLocator in interface IElementBy-Object.public boolean isElementPresent()
throws WidgetException
IElementisElementPresent in interface IElementWidgetExceptionpublic boolean isElementPresent(long timeout)
throws WidgetException
IElementisElementPresent in interface IElementtimeout - - the length of time this method will wait for this element to
be presentWidgetExceptionpublic boolean isElementPresent(boolean isJavaXPath)
throws WidgetException
IElementisElementPresent in interface IElementisJavaXPath - - if true, it attempts to find element using Java XPath API
and if false it attempts to find the element using the
WebDriver's APIWidgetExceptionpublic boolean isElementVisible()
throws WidgetException
IElementisElementVisible in interface IElementWidgetExceptionpublic boolean isElementVisible(long timeout)
throws WidgetException
IElementisElementVisible in interface IElementtimeout - - the length of time this method will wait for this element to
be presentWidgetExceptionpublic boolean isWithinBoundsOfWindow()
throws WidgetException
isWithinBoundsOfWindow in interface IElementWidgetExceptionpublic void waitForElementPresent()
throws WidgetException
IElementwaitForElementPresent in interface IElementWidgetExceptionpublic void waitForElementPresent(long time)
throws WidgetException
IElementwaitForElementPresent in interface IElementtime - - the length of time this method will wait for this element to
be presentWidgetExceptionpublic void waitForElementNotPresent()
throws WidgetException
IElementwaitForElementNotPresent in interface IElementWidgetExceptionpublic void waitForElementNotPresent(long time)
throws WidgetException
IElementwaitForElementNotPresent in interface IElementtime - - the length of time this method will wait for this element to
be presentWidgetExceptionpublic void waitForVisible()
throws WidgetException
IElementwaitForVisible in interface IElementWidgetExceptionpublic void waitForVisible(long time)
throws WidgetException
waitForVisible in interface IElementtime - MillisecondsWidgetExceptionpublic void waitForNotVisible()
throws WidgetException
IElementwaitForNotVisible in interface IElementWidgetExceptionpublic void waitForNotVisible(long time)
throws WidgetException
waitForNotVisible in interface IElementtime - MillisecondsWidgetExceptionpublic boolean isAttributePresent(String attributeName) throws WidgetException
IElementisAttributePresent in interface IElementattributeName - - the attribute that is being checked forWidgetExceptionpublic String getAttribute(String attributeName) throws WidgetException
IElementgetAttribute in interface IElementattributeName - - the attribute that is being grabbedWidgetExceptionpublic int getLocationX()
throws WidgetException
IElementgetLocationX in interface IElementWidgetExceptionpublic int getLocationY()
throws WidgetException
IElementgetLocationY in interface IElementWidgetExceptionpublic void setGUIDriver(ExtWebDriver guiDriver)
guiDriver - ExtendedWebDriver objectpublic final ExtWebDriver getGUIDriver()
public String getText() throws WidgetException
IElementgetText in interface IElementWidgetExceptionpublic boolean hasText(String text) throws WidgetException
IElementhasText in interface IElementtext - - the text that is being checked forWidgetExceptionpublic String getCssValue(String propertyName) throws WidgetException
IElementgetCssValue in interface IElementpropertyName - - the property to be checkedWidgetExceptionpublic void waitForAttributeEqualTo(String attributeName, String attributeValue) throws WidgetTimeoutException
IElementwaitForAttributeEqualTo in interface IElementattributeName - - the attribute that is having it's value waited onattributeValue - - the value that the test waits for the attribute to haveWidgetTimeoutExceptionpublic void waitForAttributeEqualTo(String attributeName, String attributeValue, long timeout) throws WidgetTimeoutException
IElementwaitForAttributeEqualTo in interface IElementattributeName - - the attribute that is having it's value waited onattributeValue - - the value that the test waits for the attribute to havetimeout - - the length of time this method will wait for the attribute
to be equal to the desired valueWidgetTimeoutExceptionpublic void waitForAttributeNotEqualTo(String attributeName, String attributeValue) throws WidgetException
IElementwaitForAttributeNotEqualTo in interface IElementattributeName - - the attribute that is having it's value waited onattributeValue - - the value that the test waits for the attribute to no longer
haveWidgetExceptionpublic void waitForText()
throws WidgetException
IElementwaitForText in interface IElementWidgetExceptionprotected org.openqa.selenium.WebElement findElement()
throws WidgetException
WidgetExceptionpublic void highlight()
throws WidgetException
highlight in interface IElementWidgetExceptionpublic void eval(String javascript) throws WidgetException
eval in interface IElementjavascript - the javascript code to be executedWidgetExceptionpublic org.openqa.selenium.WebElement getWebElement()
throws WidgetException
IElementgetWebElement in interface IElementWidgetExceptionprotected void waitForCommand(WaitForConditionTimer.ITimerCallback callback, long timeout) throws WidgetTimeoutException
callback - timeout - WidgetTimeoutExceptionpublic void waitForText(long time)
throws WidgetException,
WidgetTimeoutException
IElementwaitForText in interface IElementtime - -the length of time this method will wait for the textWidgetExceptionWidgetTimeoutExceptionpublic void waitForNotAttribute(String attributeName, String pattern, long timeout) throws WidgetException
IElementwaitForNotAttribute in interface IElementattributeName - Name of the attributepattern - String pattern to matchtimeout - MillisecondsWidgetExceptionpublic void waitForNotAttribute(String attributeName, String pattern) throws WidgetException
IElementwaitForNotAttribute in interface IElementattributeName - Name of the attributepattern - String pattern to matchWidgetExceptionpublic void waitForAttribute(String attributeName, String pattern, long timeout) throws WidgetException
IElementwaitForAttribute in interface IElementattributeName - Name of the attributepattern - String pattern to matchtimeout - MillisecondsWidgetExceptionpublic void waitForAttribute(String attributeName, String pattern) throws WidgetException
IElementwaitForAttribute in interface IElementattributeName - Name of the attributepattern - String pattern to matchWidgetExceptionpublic void waitForEnabled()
throws WidgetException
IElementwaitForEnabled in interface IElementWidgetExceptionpublic void waitForEnabled(long time)
throws WidgetException
IElementwaitForEnabled in interface IElementtime - MillisecondsWidgetExceptionpublic boolean isEnabled()
throws WidgetException
IElementisEnabled in interface IElementWidgetExceptionpublic void waitForAttributeNotEqualTo(String attributeName, String attributeValue, long timeout) throws WidgetTimeoutException
IElementwaitForAttributeNotEqualTo in interface IElementattributeName - - the attribute that is having it's value waited onattributeValue - - the value that the test waits for the attribute to no longer
havetimeout - - the length of time this method will wait for the attribute
to be no longer have to the desired valueWidgetTimeoutExceptionpublic boolean isElementNotPresent()
throws WidgetException
IElementisElementNotPresent in interface IElementWidgetExceptionpublic boolean isElementNotPresent(long timeout)
throws WidgetException
IElementisElementNotPresent in interface IElementtimeout - MillisecondsWidgetExceptionpublic void fireEvent(String event) throws WidgetException
fireEvent in interface IElementevent - the javascript code for the eventWidgetExceptionpublic String[] getChildNodesValuesText() throws WidgetException
getChildNodesValuesText in interface IElementWidgetExceptionpublic String getInnerHTML() throws WidgetException
IElementgetInnerHTML in interface IElementWidgetExceptionpublic void highlight(String colorMode) throws WidgetException
IElementhighlight in interface IElementcolorMode - - the color to be used when highlighting the elementWidgetExceptionpublic void highlight(Element.HIGHLIGHT_MODES mode) throws WidgetException
mode - WidgetExceptionpublic void scrollTo()
throws WidgetException
scrollTo in interface IElementWidgetExceptionpublic void focusOn()
throws WidgetException
focusOn in interface IElementWidgetExceptionCopyright © 2018. All rights reserved.