public class Element extends Object
Constructor and Description |
---|
Element(org.openqa.selenium.WebDriver driver,
OutputFile file,
Locator type,
String locator)
Sets up the element object.
|
Element(org.openqa.selenium.WebDriver driver,
OutputFile file,
Locator type,
String locator,
int match)
Sets up the element object.
|
Modifier and Type | Method and Description |
---|---|
Contains |
assertContains()
Verifies that the element has a particular value contained within it.
|
Equals |
assertEquals()
Verifies that the element has a particular value associated with it.
|
Excludes |
assertExcludes()
Verifies that the element doesn't have a particular value contained
within it.
|
State |
assertState()
Verifies that the element has a particular state associated to it.
|
void |
blur()
Blurs (focuses and then unfocuses) the element, but only if the element
is present, displayed, enabled, and an input.
|
void |
clear()
Clears text from the element, but only if the element is present,
displayed, enabled, and an input.
|
void |
click()
Clicks on the element, but only if the element is present, displayed and
enabled.
|
Get |
get()
Retrieves information about a particular element.
|
org.openqa.selenium.WebDriver |
getDriver()
Retrieves the Selenium driver instance
|
String |
getLocator()
Retrieves the selector set for this element
|
int |
getMatch()
Retrieves the uniqueness set for this element
|
Locator |
getType()
Retrieves the Locator set for this element
|
protected org.openqa.selenium.WebElement |
getWebElement()
Retrieves the identified matching web element using Webdriver
|
protected List<org.openqa.selenium.WebElement> |
getWebElements()
Retrieves all matching web elements using Webdriver
|
void |
hover()
Hovers over the element, but only if the element is present and
displayed.
|
Is |
is()
Retrieves information about a particular element.
|
void |
move()
Scrolls the page to the element, making it displayed on the current
viewport, but only if the element is present.
|
void |
move(long position)
Scrolls the page to the element, leaving X pixels at the top of the
viewport above it, making it displayed on the current viewport, but only
if the element is present.
|
String |
prettyOutput()
Retrieves a nicely HTML formatted output which identifies the element by
locator and selector, framed with spaces, which can be used anywhere in a
sentence
|
String |
prettyOutputEnd()
Retrieves a nicely HTML formatted output which identifies the element by
locator and selector, which should be used to end a sentence
|
String |
prettyOutputLowercase()
Retrieves a nicely HTML formatted output which identifies the element by
locator and selector, which can be used anywhere in a sentence
|
String |
prettyOutputStart()
Retrieves a nicely HTML formatted output which identifies the element by
locator and selector, which should be used at the beginning of a sentence
|
void |
select(int index)
Selects the Nth option from the element, starting from 0, but only if the
element is present, displayed, enabled, and an input.
|
void |
selectFrame()
Selects the frame represented by the element, but only if the element is
present and displayed.
|
void |
selectOption(String option)
Selects the option from the dropdown matching the provided value, but
only if the element is present, displayed, enabled, and an input.
|
void |
selectValue(String value)
Selects the value from the dropdown matching the provided value, but only
if the element is present, displayed, enabled, and an input.
|
void |
setMatch(int match)
Indicates the uniqueness match of the element to interact with.
|
void |
submit()
Submits the element, but only if the element is present, displayed and
enabled.
|
void |
type(org.openqa.selenium.Keys key)
Type the supplied key into the element, but only if the element is
present, enabled, and an input.
|
void |
type(String text)
Type the supplied text into the element, but only if the element is
present, enabled, and an input.
|
WaitFor |
waitFor()
Performs dyanamic waits on a particular element, until a particular
condition is met.
|
public Element(org.openqa.selenium.WebDriver driver, OutputFile file, Locator type, String locator)
driver
- - the selenium web driver, the underlying way all actions and
assertions are controlledfile
- - the TestOutput file. This is provided by the
SeleniumTestBase functionalitytype
- - the locator type e.g. Locator.id, Locator.xpathlocator
- - the locator string e.g. login, //input[@id='login']public Element(org.openqa.selenium.WebDriver driver, OutputFile file, Locator type, String locator, int match)
driver
- - the selenium web driver, the underlying way all actions and
assertions are controlledfile
- - the TestOutput file. This is provided by the
SeleniumTestBase functionalitytype
- - the locator type e.g. Locator.id, Locator.xpathlocator
- - the locator string e.g. login, //input[@id='login']match
- - if there are multiple matches of the selector, this is which
match (starting at 0) to interact withpublic void setMatch(int match)
match
- - if there are multiple matches of the selector, this is which
match (starting at 0) to interact withpublic Locator getType()
public String getLocator()
public int getMatch()
public org.openqa.selenium.WebDriver getDriver()
public String prettyOutputStart()
public String prettyOutputLowercase()
public String prettyOutput()
public String prettyOutputEnd()
public Is is()
public WaitFor waitFor()
public Get get()
public State assertState()
public Contains assertContains()
public Excludes assertExcludes()
public Equals assertEquals()
protected org.openqa.selenium.WebElement getWebElement()
protected List<org.openqa.selenium.WebElement> getWebElements()
public void click()
public void submit()
public void hover()
public void blur()
public void type(String text)
text
- - the text to be typed inpublic void type(org.openqa.selenium.Keys key)
key
- - the key to be pressedpublic void clear()
public void select(int index)
index
- - the select option to be selected - note, row numbering
starts at 0public void selectOption(String option)
option
- - the select option to be selectedpublic void selectValue(String value)
value
- - the select value to be selectedpublic void move()
public void move(long position)
position
- - how many pixels above the element to scroll topublic void selectFrame()
Copyright © 2017. All rights reserved.