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 locatorstring 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 locatorstring 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 envString Environment
- Source:
Returns:
root url
- Type
- String
-
getCssValue(locator, attribute)
-
Get Element Css Value
Parameters:
Name Type Description locatorstring css or xpath selector element
attributestring 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 locatorstring css or xpath selector element
attributestring name, value, class, etc
- Source:
Returns:
str
- Type
- string
Example
helper.getElementAttribute("#divid", "class"); -
getElementText(locator)
-
Get Element Text
Parameters:
Name Type Description locatorstring 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 locatorstring css or xpath selector element
- Source:
Returns:
bool
- Type
- boolean
Example
helper.isDisplayed("#divid"); -
isEnabled(locator)
-
Is enabled
Parameters:
Name Type Description locatorstring css or xpath selector element
- Source:
Returns:
bool
- Type
- boolean
Example
helper.isEnabled("#divid"); -
isSelected(locator)
-
Is selected
Parameters:
Name Type Description locatorstring 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 urlstring url to load
waitInSecondsinteger 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 elementWebElement the element
xOffsetNumber x offset
yOffsetNumber 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 elementWebElement 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 locatorstring css or xpath selector element
waitInSecondsinteger number of seconds to wait for the element to load
- Source:
Example
helper.waitFor("body", 15);