public class Element extends RunOnFailureKeywordsAdapter
| Modifier and Type | Field and Description |
|---|---|
protected BrowserManagement |
browserManagement
Instantiated BrowserManagement keyword bean
|
protected FormElement |
formElement
Instantiated FormElement keyword bean
|
protected Logging |
logging
Instantiated Logging keyword bean
|
| Constructor and Description |
|---|
Element() |
| Modifier and Type | Method and Description |
|---|---|
void |
assignIdToElement(String locator,
String id)
Assigns a temporary identifier to the element identified by
locator
This is mainly useful, when the locator is a complicated and slow XPath expression. |
void |
clearElementText(String locator)
Clears the text from element identified by locator.
|
void |
clickElement(String locator)
Click on the element identified by locator.
|
void |
clickElementAtCoordinates(String locator,
String xOffset,
String yOffset)
Click on the element identified by locator at the coordinates
xOffset and yOffset.
|
void |
clickImage(String locator)
Click on the image identified by locator.
|
void |
clickLink(String locator)
Click on the link identified by locator.
|
void |
currentFrameContains(String text) |
void |
currentFrameContains(String text,
String logLevel)
Verify the current frame contains text.
|
void |
currentFrameShouldNotContain(String text) |
void |
currentFrameShouldNotContain(String text,
String logLevel)
Verify the current frame does not contain text.
|
void |
doubleClickElement(String locator)
Double-Click on the element identified by locator.
|
void |
dragAndDrop(String source,
String target)
Drag the element identified by the locator source and move it on
top of the element identified by the locator target.
|
void |
dragAndDropByOffset(String source,
int xOffset,
int yOffset)
Drag the element identified by the locator source and move it by
xOffset and yOffset.
|
protected List<org.openqa.selenium.WebElement> |
elementFind(String locator,
boolean firstOnly,
boolean required) |
protected List<org.openqa.selenium.WebElement> |
elementFind(String locator,
boolean firstOnly,
boolean required,
String tag) |
void |
elementShouldBeClickable(String locator) |
void |
elementShouldBeClickable(String locator,
String message)
Verify the element identified by locator is clickable.
|
void |
elementShouldBeDisabled(String locator)
Verify the element identified by locator is disabled.
|
void |
elementShouldBeEnabled(String locator)
Verify the element identified by locator is enabled.
|
void |
elementShouldBeSelected(String locator) |
void |
elementShouldBeSelected(String locator,
String message)
Verify the element identified by locator is selected.
|
void |
elementShouldBeVisible(String locator) |
void |
elementShouldBeVisible(String locator,
String message)
Verify the element identified by locator is visible.
|
void |
elementShouldContain(String locator,
String text) |
void |
elementShouldContain(String locator,
String text,
String message)
Verify the element identified by locator contains text.
|
void |
elementShouldNotBeClickable(String locator) |
void |
elementShouldNotBeClickable(String locator,
String message)
Verify the element identified by locator is not clickable.
|
void |
elementShouldNotBeSelected(String locator) |
void |
elementShouldNotBeSelected(String locator,
String message)
Verify the element identified by locator is not selected.
|
void |
elementShouldNotBeVisible(String locator) |
void |
elementShouldNotBeVisible(String locator,
String message)
Verify the element identified by locator is not visible.
|
void |
elementShouldNotContain(String locator,
String text) |
void |
elementShouldNotContain(String locator,
String text,
String message)
Verify the element identified by locator does not contain
text.
|
void |
elementTextShouldBe(String locator,
String expected) |
void |
elementTextShouldBe(String locator,
String text,
String message)
Verify the text of the element identified by locator is exactly
text.
|
void |
elementTextShouldNotBe(String locator,
String expected) |
void |
elementTextShouldNotBe(String locator,
String text,
String message)
Verify the text of the element identified by locator is not
exactly text.
|
static String |
escapeXpathValue(String value) |
void |
focus(String locator)
Set the focus to the element identified by locator.
|
protected boolean |
frameContains(String locator,
String text) |
void |
frameShouldContain(String locator,
String text) |
void |
frameShouldContain(String locator,
String text,
String logLevel)
Verify the frame identified by locator contains text.
|
void |
frameShouldNotContain(String locator,
String text,
String logLevel)
Verify the frame identified by locator does not contain
text.
|
ArrayList<String> |
getAllLinks()
Returns a list containing ids of all links found in current page.
|
String |
getElementAttribute(String attributeLocator)
Returns the value of an element attribute.
|
int |
getHorizontalPosition(String locator)
Returns horizontal position of element identified by locator.
|
int |
getMatchingXpathCount(String xpath)
Returns the number of elements located the given xpath.
|
String |
getText(String locator)
Returns the text of the element identified by locator.
|
String |
getValue(String locator)
Returns the value attribute of the element identified by locator.
|
protected String |
getValue(String locator,
String tag) |
int |
getVerticalPosition(String locator)
Returns vertical position of element identified by locator.
|
protected boolean |
isClickable(String locator) |
protected boolean |
isElementPresent(String locator) |
protected boolean |
isElementPresent(String locator,
String tag) |
protected boolean |
isEnabled(String locator) |
protected boolean |
isSelected(String locator) |
protected boolean |
isTextPresent(String text) |
protected boolean |
isVisible(String locator) |
protected CharSequence |
mapAsciiKeyCodeToKey(int keyCode) |
void |
mouseDown(String locator)
Simulates pressing the left mouse button on the element identified by
locator.
|
void |
mouseDownOnImage(String locator)
Simulates pressing the left mouse button on the image identified by
locator.
|
void |
mouseDownOnLink(String locator)
Simulates pressing the left mouse button on the link identified by
locator.
|
void |
mouseOut(String locator)
Simulates moving the mouse away from the element identified by
locator.
|
void |
mouseOver(String locator)
Simulates moving the mouse over the element identified by locator.
|
void |
mouseUp(String locator)
Simulates releasing the left mouse button on the element identified by
locator.
|
void |
openContextMenu(String locator)
Opens the context menu on the element identified by locator.
|
protected boolean |
pageContains(String text) |
void |
pageShouldContain(String text) |
void |
pageShouldContain(String text,
String logLevel)
Verify the current page contains text.
|
void |
pageShouldContainElement(String locator) |
void |
pageShouldContainElement(String locator,
String message) |
void |
pageShouldContainElement(String locator,
String message,
String logLevel)
Verify the element identified by locator is found on the current
page.
|
protected void |
pageShouldContainElement(String locator,
String tag,
String message,
String logLevel) |
void |
pageShouldContainImage(String locator) |
void |
pageShouldContainImage(String locator,
String message) |
void |
pageShouldContainImage(String locator,
String message,
String logLevel)
Verify the image identified by locator is found on the current
page.
|
void |
pageShouldContainLink(String locator) |
void |
pageShouldContainLink(String locator,
String message) |
void |
pageShouldContainLink(String locator,
String message,
String logLevel)
Verify the link identified by locator is found on the current
page.
|
void |
pageShouldNotContain(String text) |
void |
pageShouldNotContain(String text,
String logLevel)
Verify the current page does not contain text.
|
void |
pageShouldNotContainElement(String locator) |
void |
pageShouldNotContainElement(String locator,
String message) |
void |
pageShouldNotContainElement(String locator,
String message,
String logLevel)
Verify the element identified by locator is not found on the
current page.
|
protected void |
pageShouldNotContainElement(String locator,
String tag,
String message,
String logLevel) |
void |
pageShouldNotContainImage(String locator) |
void |
pageShouldNotContainImage(String locator,
String message) |
void |
pageShouldNotContainImage(String locator,
String message,
String logLevel)
Verify the image identified by locator is not found on the current
page.
|
void |
pageShouldNotContainLink(String locator) |
void |
pageShouldNotContainLink(String locator,
String message) |
void |
pageShouldNotContainLink(String locator,
String message,
String logLevel)
Verify the link identified by locator is not found on the current
page.
|
protected String[] |
parseAttributeLocator(String attributeLocator) |
void |
pressKey(String locator,
String key)
Simulates pressing key on the element identified by
locator.
|
void |
simulate(String locator,
String event)
Simulates the given event on the element identified by
locator.
|
void |
xpathShouldMatchXTimes(String xpath,
int expectedXpathCount) |
void |
xpathShouldMatchXTimes(String xpath,
int expectedXpathCount,
String message) |
void |
xpathShouldMatchXTimes(String xpath,
int expectedXpathCount,
String message,
String logLevel)
Verify that the page contains the expectedXpathCount of elements
located by the given xpath.
|
runOnFailureByAspectJprotected BrowserManagement browserManagement
protected FormElement formElement
protected Logging logging
public void currentFrameContains(String text)
public void currentFrameContains(String text, String logLevel)
text - The text to verify.logLevel - Default=INFO. Optional log level.public void currentFrameShouldNotContain(String text)
public void currentFrameShouldNotContain(String text, String logLevel)
text - The text to verify.logLevel - Default=INFO. Optional log level.public void elementShouldContain(String locator, String text, String message)
locator - The locator to locate the element.text - The text to verify.message - Default=NONE. Optional custom error message.public void elementShouldNotContain(String locator, String text, String message)
locator - The locator to locate the element.text - The text to verify.message - Default=NONE. Optional custom error message.public void frameShouldContain(String locator, String text, String logLevel)
locator - The locator to locate the frame.text - The text to verify.logLevel - Default=INFO. Optional log level.public void frameShouldNotContain(String locator, String text, String logLevel)
locator - The locator to locate the frame.text - The text to verify.logLevel - Default=INFO. Optional log level.public void pageShouldContain(String text)
public void pageShouldContain(String text, String logLevel)
text - The text to verify.logLevel - Default=INFO. Optional log level.public void pageShouldNotContain(String text)
public void pageShouldNotContain(String text, String logLevel)
text - The text to verify.logLevel - Default=INFO. Optional log level.public void pageShouldContainElement(String locator)
public void pageShouldContainElement(String locator, String message, String logLevel)
locator - The locator to locate the element.message - Default=NONE. Optional custom error message.logLevel - Default=INFO. Optional log level.protected void pageShouldContainElement(String locator, String tag, String message, String logLevel)
public void pageShouldNotContainElement(String locator)
public void pageShouldNotContainElement(String locator, String message, String logLevel)
locator - The locator to locate the element.message - Default=NONE. Optional custom error message.logLevel - Default=INFO. Optional log level.protected void pageShouldNotContainElement(String locator, String tag, String message, String logLevel)
public void assignIdToElement(String locator, String id)
| Assign ID to Element | xpath=//div[@id=\"first_div\"] | my id |
| Page Should Contain Element | my id |
locator - The locator to locate the element.id - The id to assign.public void elementShouldBeEnabled(String locator)
locator - The locator to locate the element.public void elementShouldBeDisabled(String locator)
locator - The locator to locate the element.public void elementShouldBeSelected(String locator)
public void elementShouldBeSelected(String locator, String message)
locator - The locator to locate the element.message - Default=NONE. Optional custom error message.public void elementShouldNotBeSelected(String locator)
public void elementShouldNotBeSelected(String locator, String message)
locator - The locator to locate the element.message - Default=NONE. Optional custom error message.public void elementShouldBeVisible(String locator)
public void elementShouldBeVisible(String locator, String message)
locator - The locator to locate the element.message - Default=NONE. Optional custom error message.public void elementShouldNotBeVisible(String locator)
public void elementShouldNotBeVisible(String locator, String message)
locator - The locator to locate the element.message - Default=NONE. Optional custom error message.public void elementShouldBeClickable(String locator)
public void elementShouldBeClickable(String locator, String message)
locator - The locator to locate the element.message - Default=NONE. Optional custom error message.public void elementShouldNotBeClickable(String locator)
public void elementShouldNotBeClickable(String locator, String message)
locator - The locator to locate the element.message - Default=NONE. Optional custom error message.public void elementTextShouldBe(String locator, String text, String message)
locator - The locator to locate the element.text - The text to verify.message - Default=NONE. Optional custom error message.public void elementTextShouldNotBe(String locator, String text, String message)
locator - The locator to locate the element.text - The text to verify.message - Default=NONE. Optional custom error message.public String getElementAttribute(String attributeLocator)
attributeLocator - The attribute locator.public void clearElementText(String locator)
locator - The locator to locate the element.public int getHorizontalPosition(String locator)
locator - The locator to locate the element.public String getValue(String locator)
locator - The locator to locate the element.public String getText(String locator)
locator - The locator to locate the element.public int getVerticalPosition(String locator)
locator - The locator to locate the element.public void clickElement(String locator)
locator - The locator to locate the element.public void clickElementAtCoordinates(String locator, String xOffset, String yOffset)
locator - The locator to locate the element.xOffset - The horizontal offset in pixel. Negative means left, positive
right.yOffset - The vertical offset in pixel. Negative means up, positive
down.public void doubleClickElement(String locator)
locator - The locator to locate the element.public void focus(String locator)
locator - The locator to locate the element.public void dragAndDrop(String source, String target)
| Drag And Drop | elem1 | elem2 | # Move elem1 over elem2 |
source - The locator to locate the element to drag.target - The locator to locate the element where to drop the dragged
element.public void dragAndDropByOffset(String source, int xOffset, int yOffset)
| Drag And Drop By Offset | elem1 | 50 | 35 | # Move elem1 50px right and 35px down. |
source - The locator to locate the element to drag.xOffset - The horizontal offset in pixel. Negative means left, positive
right.yOffset - The vertical offset in pixel. Negative means up, positive
down.public void mouseDown(String locator)
locator - The locator to locate the element.mouseDownOnImage(java.lang.String),
mouseDownOnLink(java.lang.String)public void mouseOut(String locator)
locator - The locator to locate the element.public void mouseOver(String locator)
locator - The locator to locate the element.public void mouseUp(String locator)
locator - The locator to locate the element.public void openContextMenu(String locator)
locator - The locator to locate the element.public void simulate(String locator, String event)
locator - The locator to locate the element.event - The event to invoke.public void pressKey(String locator, String key)
| Press Key | text_field | q | # Press 'q' |
| Press Key | login_button | \\13 | # ASCII code for enter key |
locator - The locator to locate the element.key - The key to press.public void clickLink(String locator)
locator - The locator to locate the link.public ArrayList<String> getAllLinks()
public void mouseDownOnLink(String locator)
locator - The locator to locate the element.mouseDown(java.lang.String),
mouseDownOnImage(java.lang.String)public void pageShouldContainLink(String locator)
public void pageShouldContainLink(String locator, String message, String logLevel)
locator - The locator to locate the link.message - Default=NONE. Optional custom error message.logLevel - Default=INFO. Optional log level.public void pageShouldNotContainLink(String locator)
public void pageShouldNotContainLink(String locator, String message, String logLevel)
locator - The locator to locate the link.message - Default=NONE. Optional custom error message.logLevel - Default=INFO. Optional log level.public void clickImage(String locator)
locator - The locator to locate the element.public void mouseDownOnImage(String locator)
locator - The locator to locate the element.mouseDown(java.lang.String),
mouseDownOnLink(java.lang.String)public void pageShouldContainImage(String locator)
public void pageShouldContainImage(String locator, String message, String logLevel)
locator - The locator to locate the link.message - Default=NONE. Optional custom error message.logLevel - Default=INFO. Optional log level.public void pageShouldNotContainImage(String locator)
public void pageShouldNotContainImage(String locator, String message, String logLevel)
locator - The locator to locate the link.message - Default=NONE. Optional custom error message.logLevel - Default=INFO. Optional log level.public int getMatchingXpathCount(String xpath)
xpath - The XPath to match page elementspublic void xpathShouldMatchXTimes(String xpath, int expectedXpathCount)
public void xpathShouldMatchXTimes(String xpath, int expectedXpathCount, String message)
public void xpathShouldMatchXTimes(String xpath, int expectedXpathCount, String message, String logLevel)
xpath - The XPath to match page elementsexpectedXpathCount - The expected number of located elementsmessage - Default=NONE. Optional custom error message.logLevel - Default=INFO. Optional log level.protected List<org.openqa.selenium.WebElement> elementFind(String locator, boolean firstOnly, boolean required)
protected List<org.openqa.selenium.WebElement> elementFind(String locator, boolean firstOnly, boolean required, String tag)
protected boolean isTextPresent(String text)
protected boolean isEnabled(String locator)
protected boolean isVisible(String locator)
protected boolean isClickable(String locator)
protected boolean isSelected(String locator)
protected boolean isElementPresent(String locator)
protected boolean pageContains(String text)
protected CharSequence mapAsciiKeyCodeToKey(int keyCode)
Copyright © 2014. All rights reserved.