org.jboss.test.selenium.framework
Class ExtendedTypedSeleniumImpl

java.lang.Object
  extended by org.jboss.test.selenium.framework.TypedSeleniumImpl
      extended by org.jboss.test.selenium.framework.ExtendedTypedSeleniumImpl
All Implemented Interfaces:
ExtendedTypedSelenium, UnsupportedTypedSelenium, TypedSelenium
Direct Known Subclasses:
AjaxSeleniumImpl

public class ExtendedTypedSeleniumImpl
extends TypedSeleniumImpl
implements ExtendedTypedSelenium

Type-safe selenium wrapper for Selenium API with extension of some useful commands defined in ExtendedSelenium

Version:
$Revision$
Author:
Lukas Fryc

Constructor Summary
ExtendedTypedSeleniumImpl()
           
 
Method Summary
 boolean belongsClass(ElementLocator<?> elementLocator, String className)
          Checks if element given by locator is member of CSS class given by className.
 void check(ElementLocator<?> locator, boolean checked)
           Check a toggle-button (checkbox/radio) on or off.
 void doCommand(String command, String param1, String param2)
           
 void enableNetworkTrafficCapturing(boolean networkTrafficCapturingEnabled)
           Configures if the network traffic should be recorded for Selenium session.
 int getCount(IterableLocator<?> locator)
          Returns the number of elements that match the specified locator.
protected  ExtendedSelenium getExtendedSelenium()
           
 String getStyle(ElementLocator<?> elementLocator, CssProperty property)
          Get current style value of element given by locator.
 String getStyle(ElementLocator<?> elementLocator, String property)
          Get current style value of element given by locator.
 boolean isAttributePresent(AttributeLocator<?> attributeLocator)
          Verifies that the specified attribute is defined for the element.
 boolean isDisplayed(ElementLocator<?> elementLocator)
          Returns whether the element is displayed on the page.
 boolean isNetworkTrafficCapturingEnabled()
          Returns whether the network traffic should be recorded or not
 boolean isStarted()
          Indicates if selenium session was already successfully started.
 void mouseOutAt(ElementLocator<?> elementLocator, Point point)
          Simulates a user hovering a mouse out of the specified element at specific coordinates relative to element.
 void mouseOverAt(ElementLocator<?> elementLocator, Point point)
          Simulates a user hovering a mouse over the specified element at specific coordinates relative to element.
 void scrollIntoView(ElementLocator<?> elementLocator, boolean alignToTop)
          Aligns screen to top (resp.
 void start()
          Launches the browser with a new Selenium session
 void stop()
          Ends the test session, killing the browser
 
Methods inherited from class org.jboss.test.selenium.framework.TypedSeleniumImpl
addCustomRequestHeader, addLocationStrategy, addScript, addSelection, allowNativeXpath, altKeyDown, altKeyUp, answerOnNextPrompt, assignId, attachFile, attachFile, captureEntirePageScreenshot, captureEntirePageScreenshot, captureNetworkTraffic, captureScreenshot, captureScreenshot, check, chooseCancelOnNextConfirmation, chooseOkOnNextConfirmation, click, clickAt, close, containsScript, contextMenu, contextMenuAt, controlKeyDown, controlKeyUp, createCookie, createCookie, deleteAllVisibleCookies, deleteCookie, deselectPopUp, doubleClick, doubleClickAt, dragAndDrop, dragAndDropToObject, dragdrop, fireEvent, focus, getAlert, getAllButtons, getAllCookies, getAllFields, getAllLinks, getAllWindowIds, getAllWindowNames, getAllWindowTitles, getAttribute, getAttributeFromAllWindows, getBodyText, getConfirmation, getCookieByName, getCursorPosition, getElementDimension, getElementHeight, getElementIndex, getElementPosition, getElementPositionLeft, getElementPositionTop, getElementWidth, getEval, getExpression, getHtmlSource, getLocation, getMouseSpeed, getPrompt, getSelectedId, getSelectedIds, getSelectedIndex, getSelectedIndexes, getSelectedLabel, getSelectedLabels, getSelectedValue, getSelectedValues, getSelectOptions, getSpeed, getText, getTitle, getValue, getWhetherThisFrameMatchFrameExpression, getWhetherThisWindowMatchWindowExpression, goBack, highlight, ignoreAttributesWithoutValue, isAlertPresent, isChecked, isConfirmationPresent, isCookiePresent, isEditable, isElementPresent, isOrdered, isPromptPresent, isSomethingSelected, isTextPresent, isVisible, keyDown, keyDownNative, keyPress, keyPressNative, keyUp, keyUpNative, logToBrowser, metaKeyDown, metaKeyUp, mouseDown, mouseDownAt, mouseDownRight, mouseDownRightAt, mouseMove, mouseMoveAt, mouseOut, mouseOver, mouseUp, mouseUpAt, mouseUpRight, mouseUpRightAt, open, openWindow, refresh, removeAllSelections, removeScript, removeSelection, retrieveLastRemoteControlLogs, runScript, select, selectFrame, selectPopUp, selectWindow, setBrowserLogLevel, setCursorPosition, setExtensionJs, setMouseSpeed, setSpeed, setTimeout, shiftKeyDown, shiftKeyUp, shutDownSeleniumServer, submit, type, typeKeys, uncheck, useXpathLibrary, waitForCondition, waitForCondition, waitForFrameToLoad, waitForFrameToLoad, waitForPageToLoad, waitForPageToLoad, waitForPopUp, windowFocus, windowMaximize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.test.selenium.framework.TypedSelenium
addLocationStrategy, addScript, addSelection, allowNativeXpath, altKeyDown, altKeyUp, answerOnNextPrompt, assignId, captureEntirePageScreenshot, captureNetworkTraffic, captureScreenshot, check, chooseCancelOnNextConfirmation, chooseOkOnNextConfirmation, click, clickAt, close, containsScript, contextMenu, contextMenuAt, controlKeyDown, controlKeyUp, createCookie, createCookie, deleteAllVisibleCookies, deleteCookie, deselectPopUp, doubleClick, doubleClickAt, dragAndDrop, dragAndDropToObject, dragdrop, fireEvent, focus, getAlert, getAllCookies, getAttribute, getBodyText, getConfirmation, getCookieByName, getCursorPosition, getElementDimension, getElementHeight, getElementIndex, getElementPosition, getElementPositionLeft, getElementPositionTop, getElementWidth, getEval, getHtmlSource, getLocation, getMouseSpeed, getPrompt, getSelectedId, getSelectedIds, getSelectedIndex, getSelectedIndexes, getSelectedLabel, getSelectedLabels, getSelectedValue, getSelectedValues, getSelectOptions, getSpeed, getText, getTitle, getValue, goBack, highlight, ignoreAttributesWithoutValue, isAlertPresent, isChecked, isConfirmationPresent, isCookiePresent, isEditable, isElementPresent, isOrdered, isPromptPresent, isSomethingSelected, isTextPresent, isVisible, keyDown, keyDownNative, keyPress, keyPressNative, keyUp, keyUpNative, logToBrowser, metaKeyDown, metaKeyUp, mouseDown, mouseDownAt, mouseDownRight, mouseDownRightAt, mouseMove, mouseMoveAt, mouseOut, mouseOver, mouseUp, mouseUpAt, mouseUpRight, mouseUpRightAt, open, refresh, removeAllSelections, removeScript, removeSelection, retrieveLastRemoteControlLogs, runScript, select, selectFrame, setBrowserLogLevel, setCursorPosition, setMouseSpeed, setSpeed, setTimeout, shiftKeyDown, shiftKeyUp, shutDownSeleniumServer, submit, type, typeKeys, uncheck, useXpathLibrary, waitForCondition, waitForCondition, waitForFrameToLoad, waitForFrameToLoad, waitForPageToLoad, waitForPageToLoad, windowFocus, windowMaximize
 

Constructor Detail

ExtendedTypedSeleniumImpl

public ExtendedTypedSeleniumImpl()
Method Detail

getExtendedSelenium

protected ExtendedSelenium getExtendedSelenium()

isStarted

public boolean isStarted()
Description copied from interface: ExtendedTypedSelenium
Indicates if selenium session was already successfully started.

Specified by:
isStarted in interface ExtendedTypedSelenium
Returns:
true if selenium session was already successfully started; false otherwise

start

public void start()
Description copied from interface: TypedSelenium
Launches the browser with a new Selenium session

Specified by:
start in interface TypedSelenium
Overrides:
start in class TypedSeleniumImpl

stop

public void stop()
Description copied from interface: TypedSelenium
Ends the test session, killing the browser

Specified by:
stop in interface TypedSelenium
Overrides:
stop in class TypedSeleniumImpl

enableNetworkTrafficCapturing

public void enableNetworkTrafficCapturing(boolean networkTrafficCapturingEnabled)
Description copied from interface: ExtendedTypedSelenium

Configures if the network traffic should be recorded for Selenium session.

Have to be configured before the start of the Selenium session.

Specified by:
enableNetworkTrafficCapturing in interface ExtendedTypedSelenium
Parameters:
networkTrafficCapturingEnabled - whether the network traffic should be recorded or not

isNetworkTrafficCapturingEnabled

public boolean isNetworkTrafficCapturingEnabled()
Description copied from interface: ExtendedTypedSelenium
Returns whether the network traffic should be recorded or not

Specified by:
isNetworkTrafficCapturingEnabled in interface ExtendedTypedSelenium
Returns:
whether the network traffic should be recorded or not

getStyle

public String getStyle(ElementLocator<?> elementLocator,
                       String property)
Description copied from interface: ExtendedTypedSelenium
Get current style value of element given by locator. Use CSS style notation instead of JavaScript's camel notation! This methods of getting current style value haven't absolute browser compatibility. E.g.: use property "background-color" instead of "backgroundColor"

Specified by:
getStyle in interface ExtendedTypedSelenium
property - CSS style property what we can to recognize
Returns:
current value of property if its element exists and has this property value set; null value otherwise

getStyle

public String getStyle(ElementLocator<?> elementLocator,
                       CssProperty property)
Description copied from interface: ExtendedTypedSelenium
Get current style value of element given by locator.

Specified by:
getStyle in interface ExtendedTypedSelenium
property - CSS style property
Returns:
current value of property if its element exists and has this property value set; null value otherwise

scrollIntoView

public void scrollIntoView(ElementLocator<?> elementLocator,
                           boolean alignToTop)
Description copied from interface: ExtendedTypedSelenium
Aligns screen to top (resp. bottom) of element given by locator.

Specified by:
scrollIntoView in interface ExtendedTypedSelenium
alignToTop - should be top border of screen aligned to top border of element

mouseOverAt

public void mouseOverAt(ElementLocator<?> elementLocator,
                        Point point)
Description copied from interface: ExtendedTypedSelenium
Simulates a user hovering a mouse over the specified element at specific coordinates relative to element.

Specified by:
mouseOverAt in interface ExtendedTypedSelenium

mouseOutAt

public void mouseOutAt(ElementLocator<?> elementLocator,
                       Point point)
Description copied from interface: ExtendedTypedSelenium
Simulates a user hovering a mouse out of the specified element at specific coordinates relative to element.

Specified by:
mouseOutAt in interface ExtendedTypedSelenium

isDisplayed

public boolean isDisplayed(ElementLocator<?> elementLocator)
Description copied from interface: ExtendedTypedSelenium
Returns whether the element is displayed on the page.

Specified by:
isDisplayed in interface ExtendedTypedSelenium
Returns:
if style contains "display: none;" returns false, else returns true

belongsClass

public boolean belongsClass(ElementLocator<?> elementLocator,
                            String className)
Description copied from interface: ExtendedTypedSelenium
Checks if element given by locator is member of CSS class given by className.

Specified by:
belongsClass in interface ExtendedTypedSelenium
className - name of CSS class
Returns:
true if element given by locator is member of CSS class given by className

isAttributePresent

public boolean isAttributePresent(AttributeLocator<?> attributeLocator)
Description copied from interface: ExtendedTypedSelenium
Verifies that the specified attribute is defined for the element.

Specified by:
isAttributePresent in interface ExtendedTypedSelenium
Parameters:
attributeLocator - an attribute locator
Returns:
true if the element's attribute is present, false otherwise

getCount

public int getCount(IterableLocator<?> locator)
Description copied from interface: TypedSelenium
Returns the number of elements that match the specified locator.

Specified by:
getCount in interface ExtendedTypedSelenium
Specified by:
getCount in interface TypedSelenium
Overrides:
getCount in class TypedSeleniumImpl
Returns:
the number of nodes that match the specified locator

check

public void check(ElementLocator<?> locator,
                  boolean checked)
Description copied from interface: ExtendedTypedSelenium

Check a toggle-button (checkbox/radio) on or off.

Specified by:
check in interface ExtendedTypedSelenium
Parameters:
locator - an element locator
checked - if true, toggle-button will be checked on, otherwise checked off

doCommand

public void doCommand(String command,
                      String param1,
                      String param2)
Specified by:
doCommand in interface ExtendedTypedSelenium


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.