org.xwiki.test.ui.po
Class BaseElement

java.lang.Object
  extended by org.xwiki.test.ui.po.BaseElement
Direct Known Subclasses:
AttachmentsPane, BasePage, ChangesPane, ClassPropertyEditPane, CommentForm, ConfirmationBox, DatePicker, EditorElement, EditRightsPane, EntityTreeElement, FormElement, FormElement.SelectElement, HistoryPane, LiveTableElement, RichTextAreaElement, TableElement, UserPicker, UserPicker.UserElement

public class BaseElement
extends Object

Represents all elements which include web pages as well as parts of web pages.

Since:
3.2M3
Version:
$Id: 9804a20184dc66b0685951fc67421b97cba2dad3 $

Constructor Summary
BaseElement()
           
 
Method Summary
 Object executeJavascript(String javascript, Object... arguments)
           
protected  org.openqa.selenium.WebDriver getDriver()
           
protected static TestUtils getUtil()
           
 void makeAlertDialogSilent()
           
 void makeConfirmDialogSilent(boolean accept)
          There is no easy support for alert/confirm window methods yet, see - http://code.google.com/p/selenium/issues/detail?id=27 - http://www.google.com/codesearch/p?hl=en#2tHw6m3DZzo/branches /merge/common/test/java/org/openqa/selenium/AlertsTest.java The aim is : Alert alert = this.getDriver().switchTo().alert(); alert.accept(); Until then, the following hack does override the confirm method in Javascript to return the given value.
 void makeElementVisible(org.openqa.selenium.By locator)
          Shows hidden elements, as if they would be shown on hover.
 void makeElementVisible(org.openqa.selenium.WebElement element)
           
static void setContext(PersistentTestContext context)
          Used so that AllTests can set the persistent test context.
 void waitForNotificationErrorMessage(String message)
           
 void waitForNotificationSuccessMessage(String message)
           
 void waitForNotificationWarningMessage(String message)
           
 void waitUntilElementDisappears(org.openqa.selenium.By locator)
          Waits until the given element is either hidden or deleted.
 void waitUntilElementEndsWithAttributeValue(org.openqa.selenium.By locator, String attributeName, String expectedValue)
          Waits until the given element ends with a certain value for an attribute.
 void waitUntilElementHasAttributeValue(org.openqa.selenium.By locator, String attributeName, String expectedValue)
          Waits until the given element has a certain value for an attribute.
 void waitUntilElementHasTextContent(org.openqa.selenium.By locator, String expectedValue)
          Waits until the given element has a certain value as its inner text.
 void waitUntilElementIsVisible(org.openqa.selenium.By locator)
          Wait until the element given by the locator is displayed.
 void waitUntilElementsAreVisible(org.openqa.selenium.By[] locators, boolean all)
          Wait until one or all of a array of element locators are displayed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseElement

public BaseElement()
Method Detail

setContext

public static void setContext(PersistentTestContext context)
Used so that AllTests can set the persistent test context.


getDriver

protected org.openqa.selenium.WebDriver getDriver()

getUtil

protected static TestUtils getUtil()
Returns:
Utility class with functions not specific to any test or element.

waitUntilElementIsVisible

public void waitUntilElementIsVisible(org.openqa.selenium.By locator)
Wait until the element given by the locator is displayed. Give up after timeout seconds.

Parameters:
locator - the locator for the element to look for.

waitUntilElementsAreVisible

public void waitUntilElementsAreVisible(org.openqa.selenium.By[] locators,
                                        boolean all)
Wait until one or all of a array of element locators are displayed.

Parameters:
locators - the array of element locators to look for.
all - if true then don't return until all elements are found. Otherwise return after finding one.

waitUntilElementDisappears

public void waitUntilElementDisappears(org.openqa.selenium.By locator)
Waits until the given element is either hidden or deleted.

Parameters:
locator -

makeElementVisible

public void makeElementVisible(org.openqa.selenium.By locator)
Shows hidden elements, as if they would be shown on hover. Currently implemented using JavaScript. Will throw a RuntimeException if the web driver does not support JavaScript or JavaScript is disabled.

Parameters:
locator - locator used to find the element, in case multiple elements are found, the first is used

makeElementVisible

public void makeElementVisible(org.openqa.selenium.WebElement element)

waitUntilElementHasAttributeValue

public void waitUntilElementHasAttributeValue(org.openqa.selenium.By locator,
                                              String attributeName,
                                              String expectedValue)
Waits until the given element has a certain value for an attribute.

Parameters:
locator - the element to wait on
attributeName - the name of the attribute to check
expectedValue - the attribute value to wait for

waitUntilElementEndsWithAttributeValue

public void waitUntilElementEndsWithAttributeValue(org.openqa.selenium.By locator,
                                                   String attributeName,
                                                   String expectedValue)
Waits until the given element ends with a certain value for an attribute.

Parameters:
locator - the element to wait on
attributeName - the name of the attribute to check
expectedValue - the attribute value to wait for

waitUntilElementHasTextContent

public void waitUntilElementHasTextContent(org.openqa.selenium.By locator,
                                           String expectedValue)
Waits until the given element has a certain value as its inner text.

Parameters:
locator - the element to wait on
expectedValue - the content value to wait for
Since:
3.2M3

executeJavascript

public Object executeJavascript(String javascript,
                                Object... arguments)

makeConfirmDialogSilent

public void makeConfirmDialogSilent(boolean accept)
There is no easy support for alert/confirm window methods yet, see - http://code.google.com/p/selenium/issues/detail?id=27 - http://www.google.com/codesearch/p?hl=en#2tHw6m3DZzo/branches /merge/common/test/java/org/openqa/selenium/AlertsTest.java The aim is : Alert alert = this.getDriver().switchTo().alert(); alert.accept(); Until then, the following hack does override the confirm method in Javascript to return the given value.

Parameters:
accept - true to accept the confirmation dialog, false to cancel it

makeAlertDialogSilent

public void makeAlertDialogSilent()
Since:
3.2M3
See Also:
makeConfirmDialogSilent(boolean)

waitForNotificationErrorMessage

public void waitForNotificationErrorMessage(String message)
Since:
3.2M3

waitForNotificationWarningMessage

public void waitForNotificationWarningMessage(String message)
Since:
3.2M3

waitForNotificationSuccessMessage

public void waitForNotificationSuccessMessage(String message)
Since:
3.2M3


Copyright © 2004-2013 XWiki. All Rights Reserved.