|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectio.ddavison.selenium.AutomationTest
public class AutomationTest
the base test that includes all Selenium 2 functionality that you will need to get you rolling.
| Field Summary | |
|---|---|
org.openqa.selenium.interactions.Actions |
actions
|
org.openqa.selenium.WebDriver |
driver
|
static org.apache.logging.log4j.Logger |
log
|
| Constructor Summary | |
|---|---|
AutomationTest()
|
|
| Method Summary | |
|---|---|
AutomationTest |
check(org.openqa.selenium.By by)
Check a checkbox, or radio button |
AutomationTest |
check(String css)
Check a checkbox, or radio button |
AutomationTest |
click(org.openqa.selenium.By by)
Click an element. |
AutomationTest |
click(String css)
Click an element. |
AutomationTest |
closeWindow()
Closes the current active window. |
AutomationTest |
closeWindow(String regex)
Close an open window. |
static String |
findFile(String filename)
|
String |
get(String key)
Get a variable from the data warehouse. If the key is not set, then use get(String, String) |
String |
get(String key,
String defaultValue)
Get a variable from the data warehouse. |
String |
getAttribute(org.openqa.selenium.By by,
String attribute)
Get an attribute of an element |
String |
getAttribute(String css,
String attribute)
Get an attribute of an element |
String |
getText(org.openqa.selenium.By by)
Get the text of an element. |
String |
getText(String css)
Get the text of an element. |
AutomationTest |
goBack()
Navigates the browser back one page. |
AutomationTest |
hoverOver(org.openqa.selenium.By by)
Hover over an element. |
AutomationTest |
hoverOver(String css)
Hover over an element. |
boolean |
isChecked(org.openqa.selenium.By by)
Checks if the element is checked or not. |
boolean |
isChecked(String css)
Checks if the element is checked or not. |
boolean |
isPresent(org.openqa.selenium.By by)
Checks if the element is present or not. |
boolean |
isPresent(String css)
Checks if the element is present or not. |
AutomationTest |
log(Object object)
Log something as information |
AutomationTest |
logDebug(Object object)
Log something as debug |
AutomationTest |
logError(Object object)
Log something as an error |
AutomationTest |
logFatal(Object object)
Log something as fatal |
AutomationTest |
logInfo(Object object)
Log something as information |
AutomationTest |
logWarn(Object object)
Log something as a warning |
AutomationTest |
navigateTo(String url)
Navigates to an absolute or relative Url. |
AutomationTest |
selectOptionByText(org.openqa.selenium.By by,
String text)
Selects an option from a dropdown (<select> tag) based on the text displayed. |
AutomationTest |
selectOptionByText(String css,
String text)
Selects an option from a dropdown (<select> tag) based on the text displayed. |
AutomationTest |
selectOptionByValue(org.openqa.selenium.By by,
String value)
Selects an option from a dropdown (<select> tag) based on the value. |
AutomationTest |
selectOptionByValue(String css,
String value)
Selects an option from a dropdown (<select> tag) based on the value. |
AutomationTest |
setText(org.openqa.selenium.By by,
String text)
Clears the text from a text field, and sets it. |
AutomationTest |
setText(String css,
String text)
Clears the text from a text field, and sets it. |
AutomationTest |
store(String key,
String value)
Put a variable in the data warehouse. |
AutomationTest |
switchToDefaultContent()
Switch back to the default content (the first window / frame that you were on before switching) |
AutomationTest |
switchToFrame(String idOrName)
Switches to a frame or iframe. |
AutomationTest |
switchToWindow(String regex)
Switch's to a window that is already in existance. |
void |
teardown()
|
AutomationTest |
uncheck(org.openqa.selenium.By by)
Uncheck a checkbox, or radio button. |
AutomationTest |
uncheck(String css)
Uncheck a checkbox, or radio button |
AutomationTest |
validateAttribute(org.openqa.selenium.By by,
String attr,
String regex)
Validates an attribute of an element. Example: <input type="text" id="test" /> .validateAttribute(css("input#test"), "type", "text") // validates that the "type" attribute equals "test"
|
AutomationTest |
validateAttribute(String css,
String attr,
String regex)
Validates an attribute of an element. Example: <input type="text" id="test" /> .validateAttribute("input#test", "type", "text") // validates that the "type" attribute equals "test"
|
AutomationTest |
validateChecked(org.openqa.selenium.By by)
Validate that a checkbox or a radio button is checked. |
AutomationTest |
validateChecked(String css)
Validate that a checkbox or a radio button is checked. |
AutomationTest |
validateFalse(boolean condition)
Validates that a specific condition is false |
AutomationTest |
validateNotPresent(org.openqa.selenium.By by)
Validates that an element is not present. |
AutomationTest |
validateNotPresent(String css)
Validates that an element is not present. |
AutomationTest |
validatePresent(org.openqa.selenium.By by)
Validates that an element is present. |
AutomationTest |
validatePresent(String css)
Validates that an element is present. |
AutomationTest |
validateText(org.openqa.selenium.By by,
String text)
Validate that the text of an element is correct. |
AutomationTest |
validateText(String css,
String text)
Validate that the text of an element is correct. |
AutomationTest |
validateTextNot(org.openqa.selenium.By by,
String text)
Validate that the text of an element is not matching text. |
AutomationTest |
validateTextNot(String css,
String text)
Validate that the text of an element is not matching text. |
AutomationTest |
validateTextNotPresent(String text)
Validate that some text is nowhere on the page. |
AutomationTest |
validateTextPresent(String text)
Validate that text is present somewhere on the page. |
AutomationTest |
validateTrue(boolean condition)
Validates that a specific condition is true |
AutomationTest |
validateUnchecked(org.openqa.selenium.By by)
Validate that a checkbox or a radio button is unchecked. |
AutomationTest |
validateUnchecked(String css)
Validate that a checkbox or a radio button is unchecked. |
AutomationTest |
validateUrl(String regex)
Validate the Url |
org.openqa.selenium.WebElement |
waitForElement(org.openqa.selenium.By by)
Private method that acts as an arbiter of implicit timeouts of sorts.. |
AutomationTest |
waitForWindow(String regex)
Waits for a window to appear, then switches to it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final org.apache.logging.log4j.Logger log
public org.openqa.selenium.WebDriver driver
public org.openqa.selenium.interactions.Actions actions
| Constructor Detail |
|---|
public AutomationTest()
| Method Detail |
|---|
public static String findFile(String filename)
public void teardown()
public org.openqa.selenium.WebElement waitForElement(org.openqa.selenium.By by)
public AutomationTest click(String css)
css - The css element to click.
AutomationTest (for fluency)public AutomationTest click(org.openqa.selenium.By by)
by - The element to click.
AutomationTest (for fluency)
public AutomationTest setText(String css,
String text)
css - The css element to set the text of.text - The text that the element will have.
AutomationTest (for fluency)
public AutomationTest setText(org.openqa.selenium.By by,
String text)
by - The element to set the text of.text - The text that the element will have.
AutomationTest (for fluency)public AutomationTest hoverOver(String css)
css - The css element to hover over.
AutomationTest (for fluency)public AutomationTest hoverOver(org.openqa.selenium.By by)
by - The element to hover over.
AutomationTest (for fluency)public boolean isChecked(String css)
css - The css selector for the checkbox
true if the element is checked. and false if it's not.public boolean isChecked(org.openqa.selenium.By by)
by - The element
true if the element is checked. and false if it's not.public boolean isPresent(String css)
css - The css selector for the element
false if it's not.public boolean isPresent(org.openqa.selenium.By by)
by - The element
false if it's not.public String getText(String css)
This is a consolidated method that works on input's, as select boxes, and fetches the value rather than the innerHTMl.
css - The css selector of the element
AutomationTest (for fluency)public String getText(org.openqa.selenium.By by)
This is a consolidated method that works on input's, as select boxes, and fetches the value rather than the innerHTMl.
by - The element to get the text from
AutomationTest (for fluency)
public String getAttribute(String css,
String attribute)
css - The css element to get fromattribute - The attribute to get
AutomationTest (for fluency)
public String getAttribute(org.openqa.selenium.By by,
String attribute)
by - The element to get fromattribute - The attribute to get
AutomationTest (for fluency)public AutomationTest check(String css)
css - The css element to check
AutomationTest (for fluency)public AutomationTest check(org.openqa.selenium.By by)
by - The element to check
AutomationTest (for fluency)public AutomationTest uncheck(String css)
css - The css element to uncheck
AutomationTest (for fluency)public AutomationTest uncheck(org.openqa.selenium.By by)
by - The element to uncheck.
AutomationTest (for fluency)
public AutomationTest selectOptionByText(String css,
String text)
css - The css selector for the elementtext - The text that is displaying.
AutomationTest (for fluency)selectOptionByValue(By, String)
public AutomationTest selectOptionByText(org.openqa.selenium.By by,
String text)
by - The elementtext - The text that is displaying.
AutomationTest (for fluency)selectOptionByValue(By, String)
public AutomationTest selectOptionByValue(String css,
String value)
css - The css selector for the elementvalue - The value attribute of the option.
AutomationTest (for fluency)selectOptionByText(By, String)
public AutomationTest selectOptionByValue(org.openqa.selenium.By by,
String value)
by - The elementvalue - The value attribute of the option.
AutomationTest (for fluency)selectOptionByText(By, String)public AutomationTest waitForWindow(String regex)
regex - Regex enabled. Url of the window, or title.
AutomationTest (for fluency)public AutomationTest switchToWindow(String regex)
regex - Regex enabled. Url of the window, or title.
AutomationTest (for fluency)public AutomationTest closeWindow(String regex)
switchToWindow(String) to switch back context.
regex - The title of the window to close (regex enabled). You may specify null to close the active window. If you specify null then the context will switch back to the initial window.
AutomationTest (for fluency)public AutomationTest closeWindow()
AutomationTest (for fluency)public AutomationTest switchToFrame(String idOrName)
idOrName - The id or name of the frame.
AutomationTest (for fluency)public AutomationTest switchToDefaultContent()
AutomationTest (for fluency)public AutomationTest validatePresent(String css)
css - The css selector of the element
AutomationTest (for fluency)public AutomationTest validatePresent(org.openqa.selenium.By by)
by - The css selector of the element
AutomationTest (for fluency)public AutomationTest validateNotPresent(String css)
css - The css selector for the element
AutomationTest (for fluency)public AutomationTest validateNotPresent(org.openqa.selenium.By by)
by - The css selector of the element
AutomationTest (for fluency)
public AutomationTest validateText(String css,
String text)
css - The css element to validate the text of.text - The text to validate.
AutomationTest (for fluency)
public AutomationTest validateText(org.openqa.selenium.By by,
String text)
by - The element to validate the text of.text - The text to validate.
AutomationTest (for fluency)
public AutomationTest validateTextNot(String css,
String text)
css - The css element to validate the text of.text - The text to validate.
AutomationTest (for fluency)
public AutomationTest validateTextNot(org.openqa.selenium.By by,
String text)
by - The element to validate the text of.text - The text to validate.
AutomationTest (for fluency)public AutomationTest validateTextPresent(String text)
text - The text to ensure is on the page.
AutomationTest (for fluency)public AutomationTest validateTextNotPresent(String text)
text - The text to ensure is not on the page.
AutomationTest (for fluency)public AutomationTest validateChecked(String css)
css - The css selector for the element
AutomationTest (for fluency)public AutomationTest validateChecked(org.openqa.selenium.By by)
by - The css selector of the element
AutomationTest (for fluency)public AutomationTest validateUnchecked(String css)
css - The css selector for the element
AutomationTest (for fluency)public AutomationTest validateUnchecked(org.openqa.selenium.By by)
by - The element
AutomationTest (for fluency)
public AutomationTest validateAttribute(String css,
String attr,
String regex)
<input type="text" id="test" />
.validateAttribute("input#test", "type", "text") // validates that the "type" attribute equals "test"
css - The css selector of the elementattr - The attribute you'd like to validateregex - What the attribute should be. (this method supports regex)
AutomationTest (for fluency)
public AutomationTest validateAttribute(org.openqa.selenium.By by,
String attr,
String regex)
<input type="text" id="test" />
.validateAttribute(css("input#test"), "type", "text") // validates that the "type" attribute equals "test"
by - The elementattr - The attribute you'd like to validateregex - What the attribute should be. (this method supports regex)
AutomationTest (for fluency)public AutomationTest validateUrl(String regex)
regex - Regular expression to match
AutomationTest (for fluency)public AutomationTest validateTrue(boolean condition)
condition - The condition that is expected to be true
AutomationTest (for fluency)public AutomationTest validateFalse(boolean condition)
condition - The condition that is expected to be false
AutomationTest (for fluency)public AutomationTest goBack()
driver.navigate().back()
- Returns:
AutomationTest (for fluency)
public AutomationTest navigateTo(String url)
url - Use cases are:navigateTo("/login") // navigate to a relative url. slash meaning start fresh from the base url.
navigateTo("path") // navigate to a relative url. will simply append "path" to the current url.
navigateTo("http://google.com") // navigates to an absolute url.
AutomationTest (for fluency)
public AutomationTest store(String key,
String value)
key - The key to put.value - The value to put.
AutomationTest (for fluency)public String get(String key)
get(String, String)
key - The key to fetch.
AutomationTest (for fluency)
public String get(String key,
String defaultValue)
key - The key to fetch.defaultValue - The value to return if the variable is not set.
AutomationTest (for fluency)public AutomationTest log(Object object)
object - What to log.
AutomationTest (for fluency)public AutomationTest logInfo(Object object)
object - What to log
AutomationTest (for fluency)public AutomationTest logWarn(Object object)
object - What to log
AutomationTest (for fluency)public AutomationTest logError(Object object)
object - What to log
AutomationTest (for fluency)public AutomationTest logDebug(Object object)
object - What to log
AutomationTest (for fluency)public AutomationTest logFatal(Object object)
object - What to log
AutomationTest (for fluency)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||