Class: Helper

Helper

Helper Related Methods


new Helper(world)

Instantiate the object

Parameters:
Name Type Description
world World

world object instance

Source:

Methods


findElement(locator)

To find an element on the page that match the given search criteria

Parameters:
Name Type Description
locator string

css or xpath selector element

Source:
Returns:

an element that can be used to issue commands against the located element

Type
WebElementPromise
Example
helper.findElement("body");

findElements(locator)

To find all elements on the page that match the given search criteria

Parameters:
Name Type Description
locator string

css or xpath selector element

Source:
Returns:

an element that can be used to issue commands against the located element

Type
WebElementPromise
Example
helper.findElements("body");

getAppUrlForEnv(env)

Get app url for environment

Parameters:
Name Type Description
env String

Environment

Source:
Returns:

root url

Type
String

getCssValue(locator, attribute)

Get Element Css Value

Parameters:
Name Type Description
locator string

css or xpath selector element

attribute string

width, height, position, visibility, etc

Source:
Returns:

str

Type
string
Example
helper.getCssValue("#divid", "width");

getDriver()

This will return driver object instance

Source:
Returns:

Driver object

Type
WebDriver
Example
helper.getDriver();

getElementAttribute(locator, attribute)

Get Element Attribute

Parameters:
Name Type Description
locator string

css or xpath selector element

attribute string

name, value, class, etc

Source:
Returns:

str

Type
string
Example
helper.getElementAttribute("#divid", "class");

getElementText(locator)

Get Element Text

Parameters:
Name Type Description
locator string

css or xpath selector element

Source:
Returns:

str

Type
string
Example
helper.getElementText("#divid");

getWorld()

This will return world object instance

Source:
Returns:

world object

Type
World
Example
helper.getWorld();

isDisplayed(locator)

Is displayed

Parameters:
Name Type Description
locator string

css or xpath selector element

Source:
Returns:

bool

Type
boolean
Example
helper.isDisplayed("#divid");

isEnabled(locator)

Is enabled

Parameters:
Name Type Description
locator string

css or xpath selector element

Source:
Returns:

bool

Type
boolean
Example
helper.isEnabled("#divid");

isSelected(locator)

Is selected

Parameters:
Name Type Description
locator string

css or xpath selector element

Source:
Returns:

bool

Type
boolean
Example
helper.isSelected("#divid");

loadPage(url, waitInSeconds)

Load or navigate to a page with the url and check the body element is present

Parameters:
Name Type Description
url string

url to load

waitInSeconds integer

number of seconds to wait for page to load

Source:
Example
helper.loadPage("http://www.google.com");

moveSlider(element, xOffset, yOffset)

Move Slider

Parameters:
Name Type Description
element WebElement

the element

xOffset Number

x offset

yOffset Number

y offset

Source:
Example
helper.scrollToElement(el, 45, 0);

refresh()

Reload or refresh page

Source:
Example
helper.refresh();

scrollToElement(element)

Scroll to the element

Parameters:
Name Type Description
element WebElement

the element

Source:
Example
helper.scrollToElement(el);

takeScreenshot()

Take Screenshot

Source:
Example
helper.takeScreenshot();

waitFor(locator, waitInSeconds)

Wait for any element to be found

Parameters:
Name Type Description
locator string

css or xpath selector element

waitInSeconds integer

number of seconds to wait for the element to load

Source:
Example
helper.waitFor("body", 15);