org.apache.tapestry5.test
Class SeleniumTestCase

java.lang.Object
  extended by org.testng.Assert
      extended by org.apache.tapestry5.test.SeleniumTestCase
All Implemented Interfaces:
com.thoughtworks.selenium.Selenium

public abstract class SeleniumTestCase
extends org.testng.Assert
implements com.thoughtworks.selenium.Selenium

Base class for creating Selenium-based integration test cases. This class implements all the methods of Selenium and delegates to an instance (setup once per test by testStartup(org.testng.ITestContext, org.testng.xml.XmlTest).

Since:
5.2.0

Field Summary
static String JETTY_7
           
static String PAGE_LOAD_TIMEOUT
          15 seconds
protected  com.thoughtworks.selenium.Selenium selenium
          The underlying Selenium instance that all the methods of this class delegate to; this can be useful when attempting to use SeleniumTestCase with a newer version of Selenium which has added some methods to the interface.
static String SUBMIT
          An XPath expression for locating a submit element (very commonly used with clickAndWait(String).
static String TOMCAT_6
           
 
Constructor Summary
SeleniumTestCase()
           
 
Method Summary
 void addCustomRequestHeader(String key, String value)
           
 void addLocationStrategy(String strategyName, String functionDefinition)
           
 void addScript(String scriptContent, String scriptTagId)
           
 void addSelection(String locator, String optionLocator)
           
 void allowNativeXpath(String allow)
           
 void altKeyDown()
           
 void altKeyUp()
           
 void answerOnNextPrompt(String answer)
           
protected  void assertAttribute(String locator, String expected)
          Used when the locator identifies an attribute, not an element.
protected  void assertFieldValue(String locator, String expected)
          Assets that the value in the field matches the expectation
protected  void assertSourcePresent(String... expected)
          Assets that each string provided is present somewhere in the current document.
protected  void assertText(String locator, String expected)
          Asserts the text of an element, identified by the locator.
protected  void assertTextPresent(String... text)
           
protected  void assertTitle(String expected)
          Asserts that the current page's title matches the expected value.
 void assignId(String locator, String identifier)
           
 void attachFile(String fieldLocator, String fileLocator)
           
 void captureEntirePageScreenshot(String filename, String kwargs)
           
 String captureEntirePageScreenshotToString(String kwargs)
           
 String captureNetworkTraffic(String type)
           
 void captureScreenshot(String filename)
           
 String captureScreenshotToString()
           
 void check(String locator)
           
 void chooseCancelOnNextConfirmation()
           
 void chooseOkOnNextConfirmation()
           
 void cleanup()
           
 void cleanupTestMethod()
           
 void click(String locator)
           
protected  void clickAndWait(String locator)
          Click a link identified by a locator, then wait for the resulting page to load.
 void clickAt(String locator, String coordString)
           
 void close()
           
 void contextMenu(String locator)
           
 void contextMenuAt(String locator, String coordString)
           
 void controlKeyDown()
           
 void controlKeyUp()
           
 void createCookie(String nameValuePair, String optionsString)
           
 void deleteAllVisibleCookies()
           
 void deleteCookie(String name, String optionsString)
           
 void deselectPopUp()
           
 void doubleClick(String locator)
           
 void doubleClickAt(String locator, String coordString)
           
 void dragAndDrop(String locator, String movementsString)
           
 void dragAndDropToObject(String locatorOfObjectToBeDragged, String locatorOfDragDestinationObject)
           
 void dragdrop(String locator, String movementsString)
           
 void fireEvent(String locator, String eventName)
           
 void focus(String locator)
           
 String getAlert()
           
 String[] getAllButtons()
           
 String[] getAllFields()
           
 String[] getAllLinks()
           
 String[] getAllWindowIds()
           
 String[] getAllWindowNames()
           
 String[] getAllWindowTitles()
           
 String getAttribute(String attributeLocator)
           
 String[] getAttributeFromAllWindows(String attributeName)
           
 String getBaseURL()
          Returns the base URL for the application.
 String getBodyText()
           
 String getConfirmation()
           
 String getCookie()
           
 String getCookieByName(String name)
           
 Number getCssCount(String str)
           
 Number getCursorPosition(String locator)
           
 Number getElementHeight(String locator)
           
 Number getElementIndex(String locator)
           
 Number getElementPositionLeft(String locator)
           
 Number getElementPositionTop(String locator)
           
 Number getElementWidth(String locator)
           
 String getEval(String script)
           
 String getExpression(String expression)
           
 String getHtmlSource()
           
 String getLocation()
           
 String getLog()
           
 Number getMouseSpeed()
           
 String getPrompt()
           
 String getSelectedId(String selectLocator)
           
 String[] getSelectedIds(String selectLocator)
           
 String getSelectedIndex(String selectLocator)
           
 String[] getSelectedIndexes(String selectLocator)
           
 String getSelectedLabel(String selectLocator)
           
 String[] getSelectedLabels(String selectLocator)
           
 String getSelectedValue(String selectLocator)
           
 String[] getSelectedValues(String selectLocator)
           
 String[] getSelectOptions(String selectLocator)
           
 String getSpeed()
           
 String getTable(String tableCellAddress)
           
 String getText(String locator)
           
 String getTitle()
           
 String getValue(String locator)
           
 boolean getWhetherThisFrameMatchFrameExpression(String currentFrameString, String target)
           
 boolean getWhetherThisWindowMatchWindowExpression(String currentWindowString, String target)
           
 Number getXpathCount(String xpath)
           
 void goBack()
           
 void highlight(String locator)
           
 void ignoreAttributesWithoutValue(String ignore)
           
 void indicateTestMethodName(Method testMethod)
           
 boolean isAlertPresent()
           
 boolean isChecked(String locator)
           
 boolean isConfirmationPresent()
           
 boolean isCookiePresent(String name)
           
 boolean isEditable(String locator)
           
 boolean isElementPresent(String locator)
           
 boolean isOrdered(String locator1, String locator2)
           
 boolean isPromptPresent()
           
 boolean isSomethingSelected(String selectLocator)
           
 boolean isTextPresent(String pattern)
           
 boolean isVisible(String locator)
           
 void keyDown(String locator, String keySequence)
           
 void keyDownNative(String keycode)
           
 void keyPress(String locator, String keySequence)
           
 void keyPressNative(String keycode)
           
 void keyUp(String locator, String keySequence)
           
 void keyUpNative(String keycode)
           
protected  Runnable launchWebServer(String container, String webAppFolder, String contextPath, int port, int sslPort)
          Invoked from testStartup(org.testng.ITestContext, org.testng.xml.XmlTest) to launch the web server to be tested.
 void metaKeyDown()
           
 void metaKeyUp()
           
 void mouseDown(String locator)
           
 void mouseDownAt(String locator, String coordString)
           
 void mouseDownRight(String locator)
           
 void mouseDownRightAt(String locator, String coordString)
           
 void mouseMove(String locator)
           
 void mouseMoveAt(String locator, String coordString)
           
 void mouseOut(String locator)
           
 void mouseOver(String locator)
           
 void mouseUp(String locator)
           
 void mouseUpAt(String locator, String coordString)
           
 void mouseUpRight(String locator)
           
 void mouseUpRightAt(String locator, String coordString)
           
 void open(String url)
           
 void open(String url, String ignoreResponseCode)
           
protected  void openBaseURL()
          Open the getBaseURL(), and waits for the page to load.
protected  void openLinks(String... linkText)
          Opens the base URL, then clicks through a series of links to get to a desired application state.
 void openWindow(String url, String windowID)
           
 void refresh()
           
 void removeAllSelections(String locator)
           
 void removeScript(String scriptTagId)
           
 void removeSelection(String locator, String optionLocator)
           
protected  void reportAndThrowAssertionError(String message, Object... arguments)
          Formats a message from the provided arguments, which is written to System.err.
 String retrieveLastRemoteControlLogs()
           
 void rollup(String rollupName, String kwargs)
           
 void runScript(String script)
           
 void select(String selectLocator, String optionLocator)
           
 void selectFrame(String locator)
           
 void selectPopUp(String windowID)
           
 void selectWindow(String windowID)
           
 void setBrowserLogLevel(String logLevel)
           
 void setContext(String context)
           
 void setCursorPosition(String locator, String position)
           
 void setExtensionJs(String extensionJs)
           
 void setMouseSpeed(String pixels)
           
 void setSpeed(String value)
           
 void setTimeout(String timeout)
           
 void setup(org.testng.ITestContext context)
           
 void shiftKeyDown()
           
 void shiftKeyUp()
           
 void showContextualBanner()
           
 void showContextualBanner(String className, String methodName)
           
 void shutDownSeleniumServer()
           
protected  void sleep(long millis)
          Sleeps for the indicated number of seconds.
 void start()
           
 void start(Object optionsObject)
           
 void start(String optionsString)
           
 void stop()
           
 void submit(String formLocator)
           
 void testShutdown(org.testng.ITestContext context)
          Like testStartup(org.testng.ITestContext, org.testng.xml.XmlTest) , this may be called multiple times against multiple instances, but only does work the first time.
 void testStartup(org.testng.ITestContext testContext, org.testng.xml.XmlTest xmlTest)
          Starts up the servers for the entire test (i.e., for multiple TestCases).
 void type(String locator, String value)
           
 void typeKeys(String locator, String value)
           
 void uncheck(String locator)
           
protected  void unreachable()
           
 void useXpathLibrary(String libraryName)
           
protected  void waitForAjaxRequestsToComplete(String timeout)
          Deprecated. Deprecated in 5.4 as it is tied to Prototype.
 void waitForCondition(String script, String timeout)
           
protected  void waitForCSSSelectedElementToAppear(String cssRule)
          Waits, up to the page load limit for an element (identified by a CSS rule) to exist (it is not assured that the element will be visible).
protected  void waitForElementToAppear(String elementId)
          Waits for the element with the given client-side id to be present in the DOM ( does not assure that the element is visible).
protected  void waitForElementToDisappear(String elementId)
          Waits for the element to be removed from the DOM.
 void waitForFrameToLoad(String frameAddress, String timeout)
           
protected  void waitForInvisible(String selector)
          Waits for the element specified by the selector to become invisible Note that waitForElementToDisappear waits for the element to be absent from the dom, visible or not.
protected  void waitForPageInitialized()
          Waits for page initialization to finish, which is recognized by the data-page-initialized attribute being added to the HTML element.
protected  void waitForPageToLoad()
          Waits for the page to load (up to 15 seconds).
 void waitForPageToLoad(String timeout)
           
 void waitForPopUp(String windowID, String timeout)
           
protected  void waitForVisible(String selector)
          Waits for the element specified by the selector to become visible Note that waitForElementToAppear waits for the element to be present in the dom, visible or not.
 void windowFocus()
           
 void windowMaximize()
           
protected  void writeErrorReport(String reportText)
          Delegates to ErrorReporter#writeErrorReport(String) to capture the current page markup in a file for later analysis.
 
Methods inherited from class org.testng.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEqualsNoOrder, assertEqualsNoOrder, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PAGE_LOAD_TIMEOUT

public static final String PAGE_LOAD_TIMEOUT
15 seconds

See Also:
Constant Field Values

TOMCAT_6

public static final String TOMCAT_6
See Also:
Constant Field Values

JETTY_7

public static final String JETTY_7
See Also:
Constant Field Values

SUBMIT

public static final String SUBMIT
An XPath expression for locating a submit element (very commonly used with clickAndWait(String).

Since:
5.3
See Also:
Constant Field Values

selenium

protected com.thoughtworks.selenium.Selenium selenium
The underlying Selenium instance that all the methods of this class delegate to; this can be useful when attempting to use SeleniumTestCase with a newer version of Selenium which has added some methods to the interface. This field will not be set until the test case instance has gone through its full initialization.

Since:
5.3
Constructor Detail

SeleniumTestCase

public SeleniumTestCase()
Method Detail

testStartup

public void testStartup(org.testng.ITestContext testContext,
                        org.testng.xml.XmlTest xmlTest)
                 throws Exception
Starts up the servers for the entire test (i.e., for multiple TestCases). By placing <parameter> elements inside the appropriate <test> (of your testng.xml configuration file), you can change the configuration or behavior of the servers. It is common to have two or more identical tests that differ only in terms of the tapestry.browser-start-command parameter, to run tests against multiple browsers.
Parameter Name Default Description
container tapestry.servlet-container JETTY_7 The Servlet container to use for the tests. Currently JETTY_7 or TOMCAT_6
webAppFolder tapestry.web-app-folder src/main/webapp Location of web application context
contextPath tapestry.context-path empty string Context path (defaults to root). As elsewhere, the context path should be blank, or start with a slash (but not end with one).
port tapestry.port 9090 Port number for web server to listen to
sslPort tapestry.ssl-port 8443 Port number for web server to listen to for secure requests
browserStartCommand tapestry.browser-start-command *firefox Command string used to launch the browser, as defined by Selenium

Tests in the beforeStartup group will be run before the start of Selenium. This can be used to programmatically override the above parameter values.

This method will be invoked in each subclass, but is set up to only startup the servers once (it checks the ITestContext to see if the necessary keys are already present).

Parameters:
testContext - Used to share objects between the launcher and the test suites
Throws:
Exception

testShutdown

public void testShutdown(org.testng.ITestContext context)
Like testStartup(org.testng.ITestContext, org.testng.xml.XmlTest) , this may be called multiple times against multiple instances, but only does work the first time.


launchWebServer

protected Runnable launchWebServer(String container,
                                   String webAppFolder,
                                   String contextPath,
                                   int port,
                                   int sslPort)
                            throws Exception
Invoked from testStartup(org.testng.ITestContext, org.testng.xml.XmlTest) to launch the web server to be tested. The return value is a Runnable that can be invoked later to cleanly shut down the launched server at the end of the test.

Parameters:
container - identifies which web server should be launched
webAppFolder - path to the web application context
contextPath - the path the context is mapped to, usually the empty string
port - the port number the server should handle
sslPort - the port number on which the server should handle secure requests
Returns:
Runnable used to shut down the server
Throws:
Exception

setup

public void setup(org.testng.ITestContext context)

cleanup

public void cleanup()

writeErrorReport

protected void writeErrorReport(String reportText)
Delegates to ErrorReporter#writeErrorReport(String) to capture the current page markup in a file for later analysis.


getBaseURL

public String getBaseURL()
Returns the base URL for the application. This is of the typically http://localhost:9999/ (i.e., it includes a trailing slash).

Generally, you should use openLinks(String...) to start from your application's home page.


indicateTestMethodName

public void indicateTestMethodName(Method testMethod)

cleanupTestMethod

public void cleanupTestMethod()

addCustomRequestHeader

public void addCustomRequestHeader(String key,
                                   String value)
Specified by:
addCustomRequestHeader in interface com.thoughtworks.selenium.Selenium

addLocationStrategy

public void addLocationStrategy(String strategyName,
                                String functionDefinition)
Specified by:
addLocationStrategy in interface com.thoughtworks.selenium.Selenium

addScript

public void addScript(String scriptContent,
                      String scriptTagId)
Specified by:
addScript in interface com.thoughtworks.selenium.Selenium

addSelection

public void addSelection(String locator,
                         String optionLocator)
Specified by:
addSelection in interface com.thoughtworks.selenium.Selenium

allowNativeXpath

public void allowNativeXpath(String allow)
Specified by:
allowNativeXpath in interface com.thoughtworks.selenium.Selenium

altKeyDown

public void altKeyDown()
Specified by:
altKeyDown in interface com.thoughtworks.selenium.Selenium

altKeyUp

public void altKeyUp()
Specified by:
altKeyUp in interface com.thoughtworks.selenium.Selenium

answerOnNextPrompt

public void answerOnNextPrompt(String answer)
Specified by:
answerOnNextPrompt in interface com.thoughtworks.selenium.Selenium

assignId

public void assignId(String locator,
                     String identifier)
Specified by:
assignId in interface com.thoughtworks.selenium.Selenium

attachFile

public void attachFile(String fieldLocator,
                       String fileLocator)
Specified by:
attachFile in interface com.thoughtworks.selenium.Selenium

captureEntirePageScreenshot

public void captureEntirePageScreenshot(String filename,
                                        String kwargs)
Specified by:
captureEntirePageScreenshot in interface com.thoughtworks.selenium.Selenium

captureEntirePageScreenshotToString

public String captureEntirePageScreenshotToString(String kwargs)
Specified by:
captureEntirePageScreenshotToString in interface com.thoughtworks.selenium.Selenium

captureNetworkTraffic

public String captureNetworkTraffic(String type)
Specified by:
captureNetworkTraffic in interface com.thoughtworks.selenium.Selenium

captureScreenshot

public void captureScreenshot(String filename)
Specified by:
captureScreenshot in interface com.thoughtworks.selenium.Selenium

captureScreenshotToString

public String captureScreenshotToString()
Specified by:
captureScreenshotToString in interface com.thoughtworks.selenium.Selenium

check

public void check(String locator)
Specified by:
check in interface com.thoughtworks.selenium.Selenium

chooseCancelOnNextConfirmation

public void chooseCancelOnNextConfirmation()
Specified by:
chooseCancelOnNextConfirmation in interface com.thoughtworks.selenium.Selenium

chooseOkOnNextConfirmation

public void chooseOkOnNextConfirmation()
Specified by:
chooseOkOnNextConfirmation in interface com.thoughtworks.selenium.Selenium

click

public void click(String locator)
Specified by:
click in interface com.thoughtworks.selenium.Selenium

clickAt

public void clickAt(String locator,
                    String coordString)
Specified by:
clickAt in interface com.thoughtworks.selenium.Selenium

close

public void close()
Specified by:
close in interface com.thoughtworks.selenium.Selenium

contextMenu

public void contextMenu(String locator)
Specified by:
contextMenu in interface com.thoughtworks.selenium.Selenium

contextMenuAt

public void contextMenuAt(String locator,
                          String coordString)
Specified by:
contextMenuAt in interface com.thoughtworks.selenium.Selenium

controlKeyDown

public void controlKeyDown()
Specified by:
controlKeyDown in interface com.thoughtworks.selenium.Selenium

controlKeyUp

public void controlKeyUp()
Specified by:
controlKeyUp in interface com.thoughtworks.selenium.Selenium

createCookie

public void createCookie(String nameValuePair,
                         String optionsString)
Specified by:
createCookie in interface com.thoughtworks.selenium.Selenium

deleteAllVisibleCookies

public void deleteAllVisibleCookies()
Specified by:
deleteAllVisibleCookies in interface com.thoughtworks.selenium.Selenium

deleteCookie

public void deleteCookie(String name,
                         String optionsString)
Specified by:
deleteCookie in interface com.thoughtworks.selenium.Selenium

deselectPopUp

public void deselectPopUp()
Specified by:
deselectPopUp in interface com.thoughtworks.selenium.Selenium

doubleClick

public void doubleClick(String locator)
Specified by:
doubleClick in interface com.thoughtworks.selenium.Selenium

doubleClickAt

public void doubleClickAt(String locator,
                          String coordString)
Specified by:
doubleClickAt in interface com.thoughtworks.selenium.Selenium

dragAndDrop

public void dragAndDrop(String locator,
                        String movementsString)
Specified by:
dragAndDrop in interface com.thoughtworks.selenium.Selenium

dragAndDropToObject

public void dragAndDropToObject(String locatorOfObjectToBeDragged,
                                String locatorOfDragDestinationObject)
Specified by:
dragAndDropToObject in interface com.thoughtworks.selenium.Selenium

dragdrop

public void dragdrop(String locator,
                     String movementsString)
Specified by:
dragdrop in interface com.thoughtworks.selenium.Selenium

fireEvent

public void fireEvent(String locator,
                      String eventName)
Specified by:
fireEvent in interface com.thoughtworks.selenium.Selenium

focus

public void focus(String locator)
Specified by:
focus in interface com.thoughtworks.selenium.Selenium

getAlert

public String getAlert()
Specified by:
getAlert in interface com.thoughtworks.selenium.Selenium

getAllButtons

public String[] getAllButtons()
Specified by:
getAllButtons in interface com.thoughtworks.selenium.Selenium

getAllFields

public String[] getAllFields()
Specified by:
getAllFields in interface com.thoughtworks.selenium.Selenium

getAllLinks

public String[] getAllLinks()
Specified by:
getAllLinks in interface com.thoughtworks.selenium.Selenium

getAllWindowIds

public String[] getAllWindowIds()
Specified by:
getAllWindowIds in interface com.thoughtworks.selenium.Selenium

getAllWindowNames

public String[] getAllWindowNames()
Specified by:
getAllWindowNames in interface com.thoughtworks.selenium.Selenium

getAllWindowTitles

public String[] getAllWindowTitles()
Specified by:
getAllWindowTitles in interface com.thoughtworks.selenium.Selenium

getAttribute

public String getAttribute(String attributeLocator)
Specified by:
getAttribute in interface com.thoughtworks.selenium.Selenium

getAttributeFromAllWindows

public String[] getAttributeFromAllWindows(String attributeName)
Specified by:
getAttributeFromAllWindows in interface com.thoughtworks.selenium.Selenium

getBodyText

public String getBodyText()
Specified by:
getBodyText in interface com.thoughtworks.selenium.Selenium

getConfirmation

public String getConfirmation()
Specified by:
getConfirmation in interface com.thoughtworks.selenium.Selenium

getCookie

public String getCookie()
Specified by:
getCookie in interface com.thoughtworks.selenium.Selenium

getCookieByName

public String getCookieByName(String name)
Specified by:
getCookieByName in interface com.thoughtworks.selenium.Selenium

getCursorPosition

public Number getCursorPosition(String locator)
Specified by:
getCursorPosition in interface com.thoughtworks.selenium.Selenium

getElementHeight

public Number getElementHeight(String locator)
Specified by:
getElementHeight in interface com.thoughtworks.selenium.Selenium

getElementIndex

public Number getElementIndex(String locator)
Specified by:
getElementIndex in interface com.thoughtworks.selenium.Selenium

getElementPositionLeft

public Number getElementPositionLeft(String locator)
Specified by:
getElementPositionLeft in interface com.thoughtworks.selenium.Selenium

getElementPositionTop

public Number getElementPositionTop(String locator)
Specified by:
getElementPositionTop in interface com.thoughtworks.selenium.Selenium

getElementWidth

public Number getElementWidth(String locator)
Specified by:
getElementWidth in interface com.thoughtworks.selenium.Selenium

getEval

public String getEval(String script)
Specified by:
getEval in interface com.thoughtworks.selenium.Selenium

getExpression

public String getExpression(String expression)
Specified by:
getExpression in interface com.thoughtworks.selenium.Selenium

getHtmlSource

public String getHtmlSource()
Specified by:
getHtmlSource in interface com.thoughtworks.selenium.Selenium

getLocation

public String getLocation()
Specified by:
getLocation in interface com.thoughtworks.selenium.Selenium

getLog

public String getLog()
Specified by:
getLog in interface com.thoughtworks.selenium.Selenium

getMouseSpeed

public Number getMouseSpeed()
Specified by:
getMouseSpeed in interface com.thoughtworks.selenium.Selenium

getPrompt

public String getPrompt()
Specified by:
getPrompt in interface com.thoughtworks.selenium.Selenium

getSelectedId

public String getSelectedId(String selectLocator)
Specified by:
getSelectedId in interface com.thoughtworks.selenium.Selenium

getSelectedIds

public String[] getSelectedIds(String selectLocator)
Specified by:
getSelectedIds in interface com.thoughtworks.selenium.Selenium

getSelectedIndex

public String getSelectedIndex(String selectLocator)
Specified by:
getSelectedIndex in interface com.thoughtworks.selenium.Selenium

getSelectedIndexes

public String[] getSelectedIndexes(String selectLocator)
Specified by:
getSelectedIndexes in interface com.thoughtworks.selenium.Selenium

getSelectedLabel

public String getSelectedLabel(String selectLocator)
Specified by:
getSelectedLabel in interface com.thoughtworks.selenium.Selenium

getSelectedLabels

public String[] getSelectedLabels(String selectLocator)
Specified by:
getSelectedLabels in interface com.thoughtworks.selenium.Selenium

getSelectedValue

public String getSelectedValue(String selectLocator)
Specified by:
getSelectedValue in interface com.thoughtworks.selenium.Selenium

getSelectedValues

public String[] getSelectedValues(String selectLocator)
Specified by:
getSelectedValues in interface com.thoughtworks.selenium.Selenium

getSelectOptions

public String[] getSelectOptions(String selectLocator)
Specified by:
getSelectOptions in interface com.thoughtworks.selenium.Selenium

getSpeed

public String getSpeed()
Specified by:
getSpeed in interface com.thoughtworks.selenium.Selenium

getTable

public String getTable(String tableCellAddress)
Specified by:
getTable in interface com.thoughtworks.selenium.Selenium

getText

public String getText(String locator)
Specified by:
getText in interface com.thoughtworks.selenium.Selenium

getTitle

public String getTitle()
Specified by:
getTitle in interface com.thoughtworks.selenium.Selenium

getValue

public String getValue(String locator)
Specified by:
getValue in interface com.thoughtworks.selenium.Selenium

getWhetherThisFrameMatchFrameExpression

public boolean getWhetherThisFrameMatchFrameExpression(String currentFrameString,
                                                       String target)
Specified by:
getWhetherThisFrameMatchFrameExpression in interface com.thoughtworks.selenium.Selenium

getWhetherThisWindowMatchWindowExpression

public boolean getWhetherThisWindowMatchWindowExpression(String currentWindowString,
                                                         String target)
Specified by:
getWhetherThisWindowMatchWindowExpression in interface com.thoughtworks.selenium.Selenium

getXpathCount

public Number getXpathCount(String xpath)
Specified by:
getXpathCount in interface com.thoughtworks.selenium.Selenium

goBack

public void goBack()
Specified by:
goBack in interface com.thoughtworks.selenium.Selenium

highlight

public void highlight(String locator)
Specified by:
highlight in interface com.thoughtworks.selenium.Selenium

ignoreAttributesWithoutValue

public void ignoreAttributesWithoutValue(String ignore)
Specified by:
ignoreAttributesWithoutValue in interface com.thoughtworks.selenium.Selenium

isAlertPresent

public boolean isAlertPresent()
Specified by:
isAlertPresent in interface com.thoughtworks.selenium.Selenium

isChecked

public boolean isChecked(String locator)
Specified by:
isChecked in interface com.thoughtworks.selenium.Selenium

isConfirmationPresent

public boolean isConfirmationPresent()
Specified by:
isConfirmationPresent in interface com.thoughtworks.selenium.Selenium

isCookiePresent

public boolean isCookiePresent(String name)
Specified by:
isCookiePresent in interface com.thoughtworks.selenium.Selenium

isEditable

public boolean isEditable(String locator)
Specified by:
isEditable in interface com.thoughtworks.selenium.Selenium

isElementPresent

public boolean isElementPresent(String locator)
Specified by:
isElementPresent in interface com.thoughtworks.selenium.Selenium

isOrdered

public boolean isOrdered(String locator1,
                         String locator2)
Specified by:
isOrdered in interface com.thoughtworks.selenium.Selenium

isPromptPresent

public boolean isPromptPresent()
Specified by:
isPromptPresent in interface com.thoughtworks.selenium.Selenium

isSomethingSelected

public boolean isSomethingSelected(String selectLocator)
Specified by:
isSomethingSelected in interface com.thoughtworks.selenium.Selenium

isTextPresent

public boolean isTextPresent(String pattern)
Specified by:
isTextPresent in interface com.thoughtworks.selenium.Selenium

isVisible

public boolean isVisible(String locator)
Specified by:
isVisible in interface com.thoughtworks.selenium.Selenium

keyDown

public void keyDown(String locator,
                    String keySequence)
Specified by:
keyDown in interface com.thoughtworks.selenium.Selenium

keyDownNative

public void keyDownNative(String keycode)
Specified by:
keyDownNative in interface com.thoughtworks.selenium.Selenium

keyPress

public void keyPress(String locator,
                     String keySequence)
Specified by:
keyPress in interface com.thoughtworks.selenium.Selenium

keyPressNative

public void keyPressNative(String keycode)
Specified by:
keyPressNative in interface com.thoughtworks.selenium.Selenium

keyUp

public void keyUp(String locator,
                  String keySequence)
Specified by:
keyUp in interface com.thoughtworks.selenium.Selenium

keyUpNative

public void keyUpNative(String keycode)
Specified by:
keyUpNative in interface com.thoughtworks.selenium.Selenium

metaKeyDown

public void metaKeyDown()
Specified by:
metaKeyDown in interface com.thoughtworks.selenium.Selenium

metaKeyUp

public void metaKeyUp()
Specified by:
metaKeyUp in interface com.thoughtworks.selenium.Selenium

mouseDown

public void mouseDown(String locator)
Specified by:
mouseDown in interface com.thoughtworks.selenium.Selenium

mouseDownAt

public void mouseDownAt(String locator,
                        String coordString)
Specified by:
mouseDownAt in interface com.thoughtworks.selenium.Selenium

mouseDownRight

public void mouseDownRight(String locator)
Specified by:
mouseDownRight in interface com.thoughtworks.selenium.Selenium

mouseDownRightAt

public void mouseDownRightAt(String locator,
                             String coordString)
Specified by:
mouseDownRightAt in interface com.thoughtworks.selenium.Selenium

mouseMove

public void mouseMove(String locator)
Specified by:
mouseMove in interface com.thoughtworks.selenium.Selenium

mouseMoveAt

public void mouseMoveAt(String locator,
                        String coordString)
Specified by:
mouseMoveAt in interface com.thoughtworks.selenium.Selenium

mouseOut

public void mouseOut(String locator)
Specified by:
mouseOut in interface com.thoughtworks.selenium.Selenium

mouseOver

public void mouseOver(String locator)
Specified by:
mouseOver in interface com.thoughtworks.selenium.Selenium

mouseUp

public void mouseUp(String locator)
Specified by:
mouseUp in interface com.thoughtworks.selenium.Selenium

mouseUpAt

public void mouseUpAt(String locator,
                      String coordString)
Specified by:
mouseUpAt in interface com.thoughtworks.selenium.Selenium

mouseUpRight

public void mouseUpRight(String locator)
Specified by:
mouseUpRight in interface com.thoughtworks.selenium.Selenium

mouseUpRightAt

public void mouseUpRightAt(String locator,
                           String coordString)
Specified by:
mouseUpRightAt in interface com.thoughtworks.selenium.Selenium

open

public void open(String url)
Specified by:
open in interface com.thoughtworks.selenium.Selenium

open

public void open(String url,
                 String ignoreResponseCode)
Specified by:
open in interface com.thoughtworks.selenium.Selenium

openWindow

public void openWindow(String url,
                       String windowID)
Specified by:
openWindow in interface com.thoughtworks.selenium.Selenium

refresh

public void refresh()
Specified by:
refresh in interface com.thoughtworks.selenium.Selenium

removeAllSelections

public void removeAllSelections(String locator)
Specified by:
removeAllSelections in interface com.thoughtworks.selenium.Selenium

removeScript

public void removeScript(String scriptTagId)
Specified by:
removeScript in interface com.thoughtworks.selenium.Selenium

removeSelection

public void removeSelection(String locator,
                            String optionLocator)
Specified by:
removeSelection in interface com.thoughtworks.selenium.Selenium

retrieveLastRemoteControlLogs

public String retrieveLastRemoteControlLogs()
Specified by:
retrieveLastRemoteControlLogs in interface com.thoughtworks.selenium.Selenium

rollup

public void rollup(String rollupName,
                   String kwargs)
Specified by:
rollup in interface com.thoughtworks.selenium.Selenium

runScript

public void runScript(String script)
Specified by:
runScript in interface com.thoughtworks.selenium.Selenium

select

public void select(String selectLocator,
                   String optionLocator)
Specified by:
select in interface com.thoughtworks.selenium.Selenium

selectFrame

public void selectFrame(String locator)
Specified by:
selectFrame in interface com.thoughtworks.selenium.Selenium

selectPopUp

public void selectPopUp(String windowID)
Specified by:
selectPopUp in interface com.thoughtworks.selenium.Selenium

selectWindow

public void selectWindow(String windowID)
Specified by:
selectWindow in interface com.thoughtworks.selenium.Selenium

setBrowserLogLevel

public void setBrowserLogLevel(String logLevel)
Specified by:
setBrowserLogLevel in interface com.thoughtworks.selenium.Selenium

setContext

public void setContext(String context)
Specified by:
setContext in interface com.thoughtworks.selenium.Selenium

setCursorPosition

public void setCursorPosition(String locator,
                              String position)
Specified by:
setCursorPosition in interface com.thoughtworks.selenium.Selenium

setExtensionJs

public void setExtensionJs(String extensionJs)
Specified by:
setExtensionJs in interface com.thoughtworks.selenium.Selenium

setMouseSpeed

public void setMouseSpeed(String pixels)
Specified by:
setMouseSpeed in interface com.thoughtworks.selenium.Selenium

setSpeed

public void setSpeed(String value)
Specified by:
setSpeed in interface com.thoughtworks.selenium.Selenium

setTimeout

public void setTimeout(String timeout)
Specified by:
setTimeout in interface com.thoughtworks.selenium.Selenium

shiftKeyDown

public void shiftKeyDown()
Specified by:
shiftKeyDown in interface com.thoughtworks.selenium.Selenium

shiftKeyUp

public void shiftKeyUp()
Specified by:
shiftKeyUp in interface com.thoughtworks.selenium.Selenium

showContextualBanner

public void showContextualBanner()
Specified by:
showContextualBanner in interface com.thoughtworks.selenium.Selenium

showContextualBanner

public void showContextualBanner(String className,
                                 String methodName)
Specified by:
showContextualBanner in interface com.thoughtworks.selenium.Selenium

shutDownSeleniumServer

public void shutDownSeleniumServer()
Specified by:
shutDownSeleniumServer in interface com.thoughtworks.selenium.Selenium

start

public void start()
Specified by:
start in interface com.thoughtworks.selenium.Selenium

start

public void start(Object optionsObject)
Specified by:
start in interface com.thoughtworks.selenium.Selenium

start

public void start(String optionsString)
Specified by:
start in interface com.thoughtworks.selenium.Selenium

stop

public void stop()
Specified by:
stop in interface com.thoughtworks.selenium.Selenium

submit

public void submit(String formLocator)
Specified by:
submit in interface com.thoughtworks.selenium.Selenium

type

public void type(String locator,
                 String value)
Specified by:
type in interface com.thoughtworks.selenium.Selenium

typeKeys

public void typeKeys(String locator,
                     String value)
Specified by:
typeKeys in interface com.thoughtworks.selenium.Selenium

uncheck

public void uncheck(String locator)
Specified by:
uncheck in interface com.thoughtworks.selenium.Selenium

useXpathLibrary

public void useXpathLibrary(String libraryName)
Specified by:
useXpathLibrary in interface com.thoughtworks.selenium.Selenium

waitForCondition

public void waitForCondition(String script,
                             String timeout)
Specified by:
waitForCondition in interface com.thoughtworks.selenium.Selenium

waitForFrameToLoad

public void waitForFrameToLoad(String frameAddress,
                               String timeout)
Specified by:
waitForFrameToLoad in interface com.thoughtworks.selenium.Selenium

waitForPageToLoad

public void waitForPageToLoad(String timeout)
Specified by:
waitForPageToLoad in interface com.thoughtworks.selenium.Selenium

waitForPopUp

public void waitForPopUp(String windowID,
                         String timeout)
Specified by:
waitForPopUp in interface com.thoughtworks.selenium.Selenium

windowFocus

public void windowFocus()
Specified by:
windowFocus in interface com.thoughtworks.selenium.Selenium

windowMaximize

public void windowMaximize()
Specified by:
windowMaximize in interface com.thoughtworks.selenium.Selenium

reportAndThrowAssertionError

protected final void reportAndThrowAssertionError(String message,
                                                  Object... arguments)
Formats a message from the provided arguments, which is written to System.err. In addition, captures the AUT's markup, screenshot, and a report to the output directory.

Parameters:
message -
arguments -
Since:
5.4

unreachable

protected final void unreachable()

openBaseURL

protected final void openBaseURL()
Open the getBaseURL(), and waits for the page to load.


assertText

protected final void assertText(String locator,
                                String expected)
Asserts the text of an element, identified by the locator.

Parameters:
locator - identifies the element whose text value is to be asserted
expected - expected value for the element's text

assertTextPresent

protected final void assertTextPresent(String... text)

assertSourcePresent

protected final void assertSourcePresent(String... expected)
Assets that each string provided is present somewhere in the current document.

Parameters:
expected - string expected to be present

clickAndWait

protected final void clickAndWait(String locator)
Click a link identified by a locator, then wait for the resulting page to load. This is not useful for Ajax updates, just normal full-page refreshes.

Parameters:
locator - identifies the link to click

waitForPageToLoad

protected final void waitForPageToLoad()
Waits for the page to load (up to 15 seconds). This is invoked after clicking on an element that forces a full page refresh.


assertAttribute

protected final void assertAttribute(String locator,
                                     String expected)
Used when the locator identifies an attribute, not an element.

Parameters:
locator - identifies the attribute whose value is to be asserted
expected - expected value for the attribute

assertFieldValue

protected final void assertFieldValue(String locator,
                                      String expected)
Assets that the value in the field matches the expectation

Parameters:
locator - identifies the field
expected - expected value for the field
Since:
5.3

openLinks

protected final void openLinks(String... linkText)
Opens the base URL, then clicks through a series of links to get to a desired application state.

Since:
5.3

sleep

protected final void sleep(long millis)
Sleeps for the indicated number of seconds.

Since:
5.3

waitForCSSSelectedElementToAppear

protected void waitForCSSSelectedElementToAppear(String cssRule)
Waits, up to the page load limit for an element (identified by a CSS rule) to exist (it is not assured that the element will be visible).

Parameters:
cssRule - used to locate the element
Since:
5.3

waitForElementToAppear

protected final void waitForElementToAppear(String elementId)
Waits for the element with the given client-side id to be present in the DOM ( does not assure that the element is visible).

Parameters:
elementId - identifies the element
Since:
5.3

waitForElementToDisappear

protected final void waitForElementToDisappear(String elementId)
Waits for the element to be removed from the DOM.

Parameters:
elementId - client-side id of element
Since:
5.3

waitForVisible

protected final void waitForVisible(String selector)
Waits for the element specified by the selector to become visible Note that waitForElementToAppear waits for the element to be present in the dom, visible or not. waitForVisible waits for an element that already exists in the dom to become visible.

Parameters:
selector - element selector
Since:
5.3

waitForInvisible

protected final void waitForInvisible(String selector)
Waits for the element specified by the selector to become invisible Note that waitForElementToDisappear waits for the element to be absent from the dom, visible or not. waitForInvisible waits for an existing element to become invisible.

Parameters:
selector - element selector
Since:
5.3

assertTitle

protected final void assertTitle(String expected)
Asserts that the current page's title matches the expected value.

Parameters:
expected - value for title
Since:
5.3

waitForAjaxRequestsToComplete

protected final void waitForAjaxRequestsToComplete(String timeout)
Deprecated. Deprecated in 5.4 as it is tied to Prototype.

Waits until all active XHR requests are completed. However, this is Prototype-based.

Parameters:
timeout - timeout to wait for
Since:
5.3

getCssCount

public Number getCssCount(String str)
Specified by:
getCssCount in interface com.thoughtworks.selenium.Selenium

waitForPageInitialized

protected final void waitForPageInitialized()
Waits for page initialization to finish, which is recognized by the data-page-initialized attribute being added to the HTML element. Polls at 20ms intervals for 200ms.

Since:
5.4


Copyright © 2003-2012 The Apache Software Foundation.