org.alfresco.webdrone
Interface WebDrone

All Known Implementing Classes:
WebDroneImpl

public interface WebDrone

WebDrone represents an unmanned web browser used for testing Alfresco Share.

Key methods are findAndWaitById(String), which is used to find elements on the page using the id as an identifier.

The other various methods similar to findAndWait(By) are also used to find elements of the page.

The executeJavaScript(String) is an added functionality to manage JavaScript encountered on the page. The primary use of the method is to inject a script to yield a user based behaviour.


Method Summary
 void dranAndDrop(org.openqa.selenium.WebElement source, org.openqa.selenium.WebElement target)
          Drag the source element and drop into target element.
 Object executeJavaScript(String string)
          Actions custom javascript that needs to be injected to the current page.
 org.openqa.selenium.WebElement find(org.openqa.selenium.By by)
          Finds WebElement by text in html.
 List<org.openqa.selenium.WebElement> findAll(org.openqa.selenium.By by)
          Finds all possible matching WebElement.
 org.openqa.selenium.WebElement findAndWait(org.openqa.selenium.By by)
          Find WebElement by the html name attribute.
 org.openqa.selenium.WebElement findAndWait(org.openqa.selenium.By by, long timeLeft)
          Finds WebElement using By pattern with a time limit set in milliseconds.
 org.openqa.selenium.WebElement findAndWait(org.openqa.selenium.By by, long timeLeft, long interval)
          Finds WebElement using By pattern with a time limit and interval time set in milliseconds.
 org.openqa.selenium.WebElement findAndWaitById(String id)
          Finds WebElement by id, this method uses an implicit wait time which set by the WebDrone max wait time.
 List<org.openqa.selenium.WebElement> findAndWaitForElements(org.openqa.selenium.By by)
          Finds all possible matching WebElement with time limit.
 List<org.openqa.selenium.WebElement> findAndWaitForElements(org.openqa.selenium.By criteria, long waitTime)
          Finds all possible matching WebElement with time limit.
 org.openqa.selenium.WebElement findById(String title)
          Finds the WebElement by the given identifier.
 AlfrescoVersion getAlfrescoVersion()
          Gets the AlfrescoVersion that is used.
 HtmlPage getCurrentPage()
          Gets the current page in the form of a page object based on the Alfresco site type.
 String getCurrentUrl()
          Get the URL displayed on the browser.
 String getElement(String key)
          Gets the HTML element id value for the given key.
 File getScreenShot()
          Grabs the screen shot of the current page.
 String getTitle()
          Title of the page.
 boolean isReady()
           
 boolean isRenderComplete(long timeLeft)
          Verify if the page has completed render.
 void mouseOver(org.openqa.selenium.WebElement element)
          Recreating the action of hovering over a particular HTML element on a page.
 void mouseOverOnElement(org.openqa.selenium.WebElement element)
          Recreating the action of hovering over a particular HTML element on a page based Actions class.
 void navigateTo(String url)
          Navigate the browser to given URL.
 void quit()
          End Browser session.
 void refresh()
          Acts as a refresh page action similar to F5 key.
 void waitForElement(org.openqa.selenium.By locator, long timeOutInSeconds)
          Wait until the element is visible for the specified amount of time.
 void waitUntilElementDisappears(org.openqa.selenium.By locator, long timeOutInSeconds)
          Wait until the invisibility of given Element for given seconds.
 

Method Detail

isReady

boolean isReady()
Returns:
true if the instance is ready for browser requests, otherwise false.

quit

void quit()
End Browser session.


navigateTo

void navigateTo(String url)
Navigate the browser to given URL.

Parameters:
url - String URL

getCurrentPage

HtmlPage getCurrentPage()
Gets the current page in the form of a page object based on the Alfresco site type. If site type is of Share then the page returned will be a SharePage object.

Returns:
HtmlPage page object of current view

getElement

String getElement(String key)
Gets the HTML element id value for the given key.

Parameters:
key - String HTML element id
Returns:
String value of key

getCurrentUrl

String getCurrentUrl()
Get the URL displayed on the browser.

Returns:
String URL

getTitle

String getTitle()
Title of the page.


getAlfrescoVersion

AlfrescoVersion getAlfrescoVersion()
Gets the AlfrescoVersion that is used.

Returns:
AlfrescoVersion

getScreenShot

File getScreenShot()
Grabs the screen shot of the current page.

Returns:
File image of page.

find

org.openqa.selenium.WebElement find(org.openqa.selenium.By by)
Finds WebElement by text in html.

Parameters:
by - selector
Returns:
WebElement html element

isRenderComplete

boolean isRenderComplete(long timeLeft)
Verify if the page has completed render.

Parameters:
timeLeft - the maximum time allocated to do the task
Returns:
true if page has rendered.

findAndWait

org.openqa.selenium.WebElement findAndWait(org.openqa.selenium.By by)
Find WebElement by the html name attribute.

Parameters:
{@link - By}
Returns:
WebElement web element

findAndWaitById

org.openqa.selenium.WebElement findAndWaitById(String id)
Finds WebElement by id, this method uses an implicit wait time which set by the WebDrone max wait time. The method will return once the html element is found or up to max wait time has exceeded.

Parameters:
id - String identifier
Returns:
WebElement web element

findById

org.openqa.selenium.WebElement findById(String title)
Finds the WebElement by the given identifier.

Parameters:
title - identifier
Returns:
WebElement html element

findAndWait

org.openqa.selenium.WebElement findAndWait(org.openqa.selenium.By by,
                                           long timeLeft)
Finds WebElement using By pattern with a time limit set in milliseconds. The method will return once the html element is found or up to time limit set has exceeded.

Parameters:
by - method to find element on page
timeLeft -
Returns:
WebElement element searched

findAndWait

org.openqa.selenium.WebElement findAndWait(org.openqa.selenium.By by,
                                           long timeLeft,
                                           long interval)
Finds WebElement using By pattern with a time limit and interval time set in milliseconds. The method will return once the html element is found or up to time limit set has exceeded. This method also allows to set the polling frequency.

Parameters:
by - method to find element on page
timeLeft -
interval -
Returns:
WebElement element searched

executeJavaScript

Object executeJavaScript(String string)
Actions custom javascript that needs to be injected to the current page.

Parameters:
string - javascript code
Returns:
Object reponse of the javascript

findAll

List<org.openqa.selenium.WebElement> findAll(org.openqa.selenium.By by)
Finds all possible matching WebElement.

Parameters:
by - By criteria
Returns:
Collection of WebElements

findAndWaitForElements

List<org.openqa.selenium.WebElement> findAndWaitForElements(org.openqa.selenium.By criteria,
                                                            long waitTime)
Finds all possible matching WebElement with time limit.

Parameters:
criteria - By
waitTime - the max time to wait
Returns:
Collection of WebElements

findAndWaitForElements

List<org.openqa.selenium.WebElement> findAndWaitForElements(org.openqa.selenium.By by)
Finds all possible matching WebElement with time limit.

Parameters:
by - By the criteria to search by.
Returns:
Collection of WebElements

refresh

void refresh()
Acts as a refresh page action similar to F5 key.


mouseOver

void mouseOver(org.openqa.selenium.WebElement element)
Recreating the action of hovering over a particular HTML element on a page.

Parameters:
element - WebElement target

mouseOverOnElement

void mouseOverOnElement(org.openqa.selenium.WebElement element)
Recreating the action of hovering over a particular HTML element on a page based Actions class.

Parameters:
element - WebElement target

dranAndDrop

void dranAndDrop(org.openqa.selenium.WebElement source,
                 org.openqa.selenium.WebElement target)
Drag the source element and drop into target element.

Parameters:
source - Source Element
target - Target Element

waitUntilElementDisappears

void waitUntilElementDisappears(org.openqa.selenium.By locator,
                                long timeOutInSeconds)
Wait until the invisibility of given Element for given seconds.

Parameters:
locator - CSS Locator
timeOutInSeconds - Timeout In Seconds

waitForElement

void waitForElement(org.openqa.selenium.By locator,
                    long timeOutInSeconds)
Wait until the element is visible for the specified amount of time.

Parameters:
locator - CSS Locator
timeOutInSeconds - Timeout In Seconds


Copyright © 2013. All Rights Reserved.