org.aludratest.service.gui.web.selenium.selenium1
Class Selenium1Interaction

java.lang.Object
  extended by org.aludratest.service.gui.web.selenium.selenium1.AbstractSeleniumAction
      extended by org.aludratest.service.gui.web.selenium.selenium1.Selenium1Interaction
All Implemented Interfaces:
Action, GUIInteraction, WebGUIInteraction, Interaction

public class Selenium1Interaction
extends AbstractSeleniumAction
implements WebGUIInteraction

Provides to Web GUI interaction features.

Author:
Marcel Malitz, Joerg Langnickel, Volker Bergmann

Field Summary
 
Fields inherited from class org.aludratest.service.gui.web.selenium.selenium1.AbstractSeleniumAction
wrapper
 
Constructor Summary
Selenium1Interaction(SeleniumWrapper seleniumWrapper)
          Constructor.
 
Method Summary
 void addCustomHttpHeaderCommand(String key, String value)
          Tells the Selenium server to add the specified key and value as a custom outgoing request header.
 void assignFileResource(String elementType, String elementName, GUIElementLocator locator, String filePath, int taskCompletionTimeout)
          Assigns a file resource of the test project file system to the file chooser specified by the locator.
 void changeCheckbox(String elementType, String operation, GUIElementLocator locator, int taskCompletionTimeout)
          Changes the selection state of a checkbox.
 void click(String elementType, String operation, GUIElementLocator locator, int taskCompletionTimeout)
          Clicks with a single click on any kind of element which reacts on click events.
 void closeOtherWindows(String elementType, String operation, TitleLocator locator)
          Closes all open windows which do not have the specified title.
 void closeWindows(String elementType, String operation, TitleLocator locator)
          Closes all windows identified by their name.
 void deselectCheckbox(String elementType, String operation, GUIElementLocator locator, int taskCompletionTimeout)
          Deselects a checkbox.
 void doubleClick(String elementType, String operation, GUIElementLocator locator, int taskCompletionTimeout)
          Does a double click on the element which is identified by the locator.
 NodeList evalXPath(String xpath)
          Evaluates arbitrary XPath and outputs its result as NodeList object.
 NodeList evalXPath(XPathLocator locator)
          Does the same like WebGUIInteraction.evalXPath(String) does.
 String evalXPathAsString(String xpath)
          Evaluates arbitrary XPath and outputs its result as String.
 void focus(String elementType, String operation, GUIElementLocator locator)
          Gives focus on an element.
 void functionalError(String msg)
           
 String getInputFieldSelectedLabel(String elementType, String operation, GUIElementLocator locator)
          Reads the selected label of an input field and returns it as a String without conversion/manipulation.
 String getInputFieldValue(String elementType, String operation, GUIElementLocator locator)
          Reads the value of an inputfield and returns it as a String without conversion/manipulation.
 String getText(String elementType, String operation, GUIElementLocator locator)
          Gets the text of an element.
 String getText(String elementType, String operation, GUIElementLocator locator, boolean checkVisible)
          Gets the text of an element and is adjustable to the check of the visibility of the element
 void keyPress(int keycode)
          Presses a key on the keyboard.
 void open()
          Opens the main URL of the Application Unter Test (configuration property: url.of.aut) in a new browser window and waits until the page is fully loaded.
 void refresh()
          Refreshes the page of the currently selected window and waits until the page is fully loaded.
 void selectCheckbox(String elementType, String operation, GUIElementLocator locator, int taskCompletionTimeout)
          Selects a checkbox.
 void selectDropDownEntry(String elementType, String operation, GUIElementLocator locator, OptionLocator optionLocator, int taskCompletionTimeout)
          Selects an entry in a dropdownbox with the help of a OptionLocator.
 void selectRadiobutton(String elementType, String operation, GUIElementLocator locator, int taskCompletionTimeout)
          Selects a radio button.
 void selectWindow(WindowLocator locator)
          Selects a window using a window locator.
 void switchToIFrame(GUIElementLocator iframeLocator)
          Switches to the given iframe element of the current web page in the current window, or switches back to default content.
 void type(String elementType, String operation, GUIElementLocator locator, String text, int taskCompletionTimeout)
          Types in some text without conversion/manipulation of the passed through text.
 void waitForWindowToBeClosed(String elementType, String elementName, TitleLocator locator, int taskCompletionTimeout)
          Waits until the given window is closed, or the given timeout is reached.
 void windowFocus()
          Gives focus to the currently selected window.
 void windowMaximize()
          Maximizes the currently selected window.
 void wrongPageFlow(String msg)
           
 
Methods inherited from class org.aludratest.service.gui.web.selenium.selenium1.AbstractSeleniumAction
createAttachments, createDebugAttachments, saveSource, setSystemConnector, takeScreenShot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.aludratest.service.Action
createAttachments, createDebugAttachments, setSystemConnector
 

Constructor Detail

Selenium1Interaction

public Selenium1Interaction(SeleniumWrapper seleniumWrapper)
Constructor.

Parameters:
seleniumWrapper - The SeleniumWrapper to use.
Method Detail

selectRadiobutton

public void selectRadiobutton(String elementType,
                              String operation,
                              GUIElementLocator locator,
                              int taskCompletionTimeout)
Description copied from interface: GUIInteraction
Selects a radio button. If this radio button belongs to a group of radio buttons, the other radio buttons of this group will be unselected.

Specified by:
selectRadiobutton in interface GUIInteraction
Parameters:
elementType - the type of the related radio button to log
operation - the name of the related radio button to log
locator - to locate one specific radio button in the SUT

changeCheckbox

public void changeCheckbox(String elementType,
                           String operation,
                           GUIElementLocator locator,
                           int taskCompletionTimeout)
Description copied from interface: GUIInteraction
Changes the selection state of a checkbox. If this method will be called on a checkbox which is still selected, the checkbox will be unselected.

Specified by:
changeCheckbox in interface GUIInteraction
Parameters:
elementType - the type of the related checkbox to log
operation - the name of the related checkbox to log
locator - to locate one specific checkbox in the application under test

selectCheckbox

public void selectCheckbox(String elementType,
                           String operation,
                           GUIElementLocator locator,
                           int taskCompletionTimeout)
Description copied from interface: GUIInteraction
Selects a checkbox. If the checkbox is already selected, this method will do nothing.

Specified by:
selectCheckbox in interface GUIInteraction
Parameters:
elementType - the type of the related checkbox to log
operation - the name of the related checkbox to log
locator - to locate one specific checkbox in the application under test

deselectCheckbox

public void deselectCheckbox(String elementType,
                             String operation,
                             GUIElementLocator locator,
                             int taskCompletionTimeout)
Description copied from interface: GUIInteraction
Deselects a checkbox. If the checkbox is not selected, this method will do nothing.

Specified by:
deselectCheckbox in interface GUIInteraction
Parameters:
elementType - the type of the related checkbox to log
operation - the name of the related checkbox to log
locator - to locate one specific checkbox in the application under test

selectDropDownEntry

public void selectDropDownEntry(String elementType,
                                String operation,
                                GUIElementLocator locator,
                                OptionLocator optionLocator,
                                int taskCompletionTimeout)
Description copied from interface: GUIInteraction
Selects an entry in a dropdownbox with the help of a OptionLocator. First it locates the element with the help of the locator, then it tries to select an entry defined by optionLocator.

Specified by:
selectDropDownEntry in interface GUIInteraction
Parameters:
elementType - the type of the related dropdownbox to log
operation - the name of the related dropdownbox to log
locator - to locate one specific dropdownbox in the application under test
optionLocator - defines which entry of the located dropdownbox shall be selected

type

public void type(String elementType,
                 String operation,
                 GUIElementLocator locator,
                 String text,
                 int taskCompletionTimeout)
Description copied from interface: GUIInteraction
Types in some text without conversion/manipulation of the passed through text. The content of the locator will be deleted, if the expected text is not set.

Specified by:
type in interface GUIInteraction
Parameters:
elementType - the type of the related GUI element to log
operation - the name of the related GUI element to log
locator - to locate one specific inputfield in the application under test. An inputfield is any GUI element which accepts user inputs.
text - which shall be typed in without conversion/manipulation

assignFileResource

public void assignFileResource(String elementType,
                               String elementName,
                               GUIElementLocator locator,
                               String filePath,
                               int taskCompletionTimeout)
Description copied from interface: GUIInteraction
Assigns a file resource of the test project file system to the file chooser specified by the locator.

Specified by:
assignFileResource in interface GUIInteraction
Parameters:
elementType - the type of the related GUI element to log
elementName - the name of the related GUI element to log
locator - to locate the related file selection field in the application under test
filePath - the absolute path of the file to be assigned to the file chooser
taskCompletionTimeout - the maximum number of milliseconds to wait for the completion of system activities

click

public void click(String elementType,
                  String operation,
                  GUIElementLocator locator,
                  int taskCompletionTimeout)
Description copied from interface: GUIInteraction
Clicks with a single click on any kind of element which reacts on click events. A common example are buttons and links.

Specified by:
click in interface GUIInteraction
Parameters:
elementType - the type of the related GUI element to log
operation - the name of the related GUI element to log
locator - to locate buttons, links or any other elements which react on mouse clicks.

getInputFieldValue

public String getInputFieldValue(String elementType,
                                 String operation,
                                 GUIElementLocator locator)
Description copied from interface: GUIInteraction
Reads the value of an inputfield and returns it as a String without conversion/manipulation.

Specified by:
getInputFieldValue in interface GUIInteraction
Parameters:
elementType - the type of the related GUI element to log
operation - the name of the related GUI element to log
locator - to locate the inputfield in the application under test where the inputfield must be an element for user inputs. Two examples are single line inputfields and text areas in web applications. This action works also with disabled inputfields.
Returns:
the value of the inputfield. If the inputfield could not be found, null will be returned

getInputFieldSelectedLabel

public String getInputFieldSelectedLabel(String elementType,
                                         String operation,
                                         GUIElementLocator locator)
Description copied from interface: GUIInteraction
Reads the selected label of an input field and returns it as a String without conversion/manipulation.

Specified by:
getInputFieldSelectedLabel in interface GUIInteraction
Parameters:
elementType - the type of the related GUI element to log
operation - the name of the related GUI element to log
locator - to locate the input field in the application under test where the inputfield must be an element for user inputs. Two examples are dropdown boxes and lists in web applications. This action works also with disabled input fields.
Returns:
the value of the input field. If the input field could not be found, null will be returned

selectWindow

public void selectWindow(WindowLocator locator)
Description copied from interface: GUIInteraction
Selects a window using a window locator. Once a window has been selected, all commands go to that window.

Specified by:
selectWindow in interface GUIInteraction
Parameters:
locator - to locate one specific window of the application under test

getText

public String getText(String elementType,
                      String operation,
                      GUIElementLocator locator)
Description copied from interface: GUIInteraction
Gets the text of an element.

Specified by:
getText in interface GUIInteraction
Parameters:
elementType - the type of the related GUI element to log
operation - the name of the related GUI element to log
locator - points to one element
Returns:
the unmodified text of an element

getText

public String getText(String elementType,
                      String operation,
                      GUIElementLocator locator,
                      boolean checkVisible)
Description copied from interface: GUIInteraction
Gets the text of an element and is adjustable to the check of the visibility of the element

Specified by:
getText in interface GUIInteraction
Parameters:
elementType - the type of the related GUI element to log
operation - the name of the related GUI element to log
locator - points to one element, visible: to check visibility of the element
Returns:
the unmodified text of an element

open

public void open()
Description copied from interface: WebGUIInteraction
Opens the main URL of the Application Unter Test (configuration property: url.of.aut) in a new browser window and waits until the page is fully loaded. This method has to be called before most methods of the check(), perform() and verify() objects can be used.

Specified by:
open in interface WebGUIInteraction

refresh

public void refresh()
Description copied from interface: WebGUIInteraction
Refreshes the page of the currently selected window and waits until the page is fully loaded.

Specified by:
refresh in interface WebGUIInteraction

windowMaximize

public void windowMaximize()
Description copied from interface: WebGUIInteraction
Maximizes the currently selected window.

Specified by:
windowMaximize in interface WebGUIInteraction

windowFocus

public void windowFocus()
Description copied from interface: WebGUIInteraction
Gives focus to the currently selected window.

Specified by:
windowFocus in interface WebGUIInteraction

switchToIFrame

public void switchToIFrame(GUIElementLocator iframeLocator)
Description copied from interface: WebGUIInteraction
Switches to the given iframe element of the current web page in the current window, or switches back to default content.

Specified by:
switchToIFrame in interface WebGUIInteraction
Parameters:
iframeLocator - Locator which uniquely identifies the inner frame to switch to. Use null to switch back to default content.

focus

public void focus(String elementType,
                  String operation,
                  GUIElementLocator locator)
Description copied from interface: GUIInteraction
Gives focus on an element.

Specified by:
focus in interface GUIInteraction
Parameters:
elementType - the type of the related GUI element to log
operation - the name of the related GUI element to log
locator - of the element which shall get the focus

keyPress

public void keyPress(int keycode)
Description copied from interface: GUIInteraction
Presses a key on the keyboard. Available key codes can be found in KeyEvent.

Specified by:
keyPress in interface GUIInteraction
Parameters:
keycode - is the key which shall be pressed.
See Also:
KeyEvent

doubleClick

public void doubleClick(String elementType,
                        String operation,
                        GUIElementLocator locator,
                        int taskCompletionTimeout)
Description copied from interface: GUIInteraction
Does a double click on the element which is identified by the locator.

Specified by:
doubleClick in interface GUIInteraction
Parameters:
elementType - the type of the related GUI element to log
operation - the name of the related GUI element to log
locator - which identifies the element which shall be double clicked

closeOtherWindows

public void closeOtherWindows(String elementType,
                              String operation,
                              TitleLocator locator)
Description copied from interface: GUIInteraction
Closes all open windows which do not have the specified title.

Specified by:
closeOtherWindows in interface GUIInteraction
Parameters:
elementType - the type of the target windows to log
operation - the name of the target windows to log
locator - is a window locator or just a String which will be automatically converted to one of the default locators depending on the underlying driver and the used default localization mechanism

closeWindows

public void closeWindows(String elementType,
                         String operation,
                         TitleLocator locator)
Description copied from interface: GUIInteraction
Closes all windows identified by their name. That means, that if there are several windows with same name all will be closed. This method is not waiting for a window to open.

Specified by:
closeWindows in interface GUIInteraction
Parameters:
elementType - the type of the target windows to log
operation - the name of the target windows to log
locator - - name of the window

waitForWindowToBeClosed

public void waitForWindowToBeClosed(String elementType,
                                    String elementName,
                                    TitleLocator locator,
                                    int taskCompletionTimeout)
Description copied from interface: GUIInteraction
Waits until the given window is closed, or the given timeout is reached. This is especially useful if a window is closed asynchronously some time after some event (e.g. a button click).

Specified by:
waitForWindowToBeClosed in interface GUIInteraction
Parameters:
elementType - the type of the target windows to log
elementName - the name of the target windows to log
locator - is a window locator or just a String which will be automatically converted to one of the default locators depending on the underlying driver and the used default localization mechanism
taskCompletionTimeout - Timeout to wait until the window is closed. If the timeout is triggered, a TimeoutException is raised. A value of -1 indicates to use the default configured timeout.

addCustomHttpHeaderCommand

public void addCustomHttpHeaderCommand(String key,
                                       String value)
Description copied from interface: WebGUIInteraction
Tells the Selenium server to add the specified key and value as a custom outgoing request header. This only works if the browser is configured to use the built in Selenium proxy.

Specified by:
addCustomHttpHeaderCommand in interface WebGUIInteraction
Parameters:
key - the header name
value - the header value

wrongPageFlow

public void wrongPageFlow(String msg)
Specified by:
wrongPageFlow in interface GUIInteraction

functionalError

public void functionalError(String msg)
Specified by:
functionalError in interface GUIInteraction

evalXPath

public NodeList evalXPath(XPathLocator locator)
Description copied from interface: WebGUIInteraction
Does the same like WebGUIInteraction.evalXPath(String) does.

Specified by:
evalXPath in interface WebGUIInteraction
Parameters:
locator - whose XPath expression will be taken and evaluated
Returns:
NodeList object containing XPath evaluation result

evalXPath

public NodeList evalXPath(String xpath)
Description copied from interface: WebGUIInteraction
Evaluates arbitrary XPath and outputs its result as NodeList object.

Specified by:
evalXPath in interface WebGUIInteraction
Parameters:
xpath - XPath expression to be executed
Returns:
NodeList object containing XPath evaluation result

evalXPathAsString

public String evalXPathAsString(String xpath)
Description copied from interface: WebGUIInteraction
Evaluates arbitrary XPath and outputs its result as String.

Specified by:
evalXPathAsString in interface WebGUIInteraction
Parameters:
xpath - XPath expression to be executed
Returns:
String containing XPath evaluation result


Copyright © 2015 aludratest.org. All rights reserved.