this.driver class methods
- .navigateTo(url, checkUrl)
- .refreshCurrentPage()
- .close()
- .waitForElements(strategy, locator) ⇒
*
- .waitForElement(strategy, locator) ⇒
WebElementPromise
- .click(strategy, locator, caller)
- .type(strategy, locator, value)
- .fillInDate(baseId)
- .clear(strategy, locator)
- .getText(strategy, locator, waitForText)
- .getTexts(strategy, locator)
- .checkTextsAre(strategy, locator, stringArr)
- .waitUntilTextIs(strategy, locator, value, timeout)
- .waitUntilInputIs(strategy, locator, value)
- .waitUntilNumberOfElementsFound(strategy, locator, count)
- .waitUntilTextContains(strategy, locator, value, timeout)
- .findElements(strategy, locator) ⇒
*
- .scrollToElement(element) ⇒
Promise.<void>
- .isElementVisible(element) ⇒
boolean
- .selectRadioButtonById(id)
- .selectCheckboxById(id)
- .waitForCheckboxToBeSelected(id)
- .waitForCheckboxToBeDisabled(id)
- .selectDropdownItem(parentId, itemIndex)
- .waitForPageLoadComplete() ⇒
Promise.<void>
- .waitUntilUrlContains(prefix)
- .waitUntilUrlIs(url)
- .openNewTab(url)
- .validateInNewTabAndClose(callback)
- .waitForElementToBeNotVisible(strategy, locator)
- .waitForElementToBeVisible(strategy, locator)
- .getBrowserConsoleLogs() ⇒
string
- .uploadFile(strategy, locator, filepath)
- .throwErrorWithDetailsIfNotStale(strategy, locator, fxName, error, callback)
- .waitForCookie(title)
- .getCookie(title)
- .waitForCookieToClear(title)
- .waitForCookieToEqual(title, value)
- .processAndThrowError(error, errorStack)
Navigate to a particular URL, with optional verification of navigated URL
Param | Type | Default | Description |
---|---|---|---|
url | string |
URL to navigate | |
checkUrl | boolean |
true |
Optional verification to check if navigation was successful within timeout |
Refresh current page
Quit or close the current driver session
Wait for specified element(s) to appear and returns them as an array
Returns: *
- Returns the array of WebElementPromises if found;
Param | Type | Description |
---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' |
locator | string |
value of element to search, corresponding to locator strategy |
Wait for A SINGLE specified element to appear and returns them as an array
Returns: WebElementPromise
- Returns a WebElementPromise if found;
Param | Type | Description |
---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' |
locator | string |
value of element to search, corresponding to locator strategy |
Click on an element in the webpage
Param | Type | Description |
---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' |
locator | string |
value of element to search, corresponding to locator strategy |
caller | function |
Optional parameter to indicate the function name that called this method |
Type value into the specified input field element in the webpage
Param | Type | Description |
---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' |
locator | string |
value of input field element to search, corresponding to locator strategy |
value | string |
Value to be entered in the input field |
Custom function to enter date, month and year value in a 3-split dd-mm-YYYY date field
Param | Type | Description |
---|---|---|
baseId | string |
Id value of the element based on 'id' locator strategy |
Clear value present in an input field element in the webpage
Param | Type | Description |
---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' |
locator | string |
value of input field element to search, corresponding to locator strategy |
Waits for elements as specified, and returns the text
attribute of the first element
Param | Type | Default | Description |
---|---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' | |
locator | string |
value of element to search, corresponding to locator strategy | |
waitForText | boolean |
false |
set to true, if function should wait until element text is not empty |
Waits for elements as specified, and returns the text
attribute of the all the elements
Param | Type | Description |
---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' |
locator | string |
value of element to search, corresponding to locator strategy |
Custom function to verify multiple text values in multiple elements discovered using a common locator strategy
Param | Type | Description |
---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' |
locator | string |
value of element to search, corresponding to locator strategy |
stringArr | Array |
Array of text values to be verified in the discovered elements |
Waits until the element's innertext value is equal to expected text, within timeout
Param | Type | Description |
---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' |
locator | string |
value of element to search, corresponding to locator strategy |
value | string |
expected text value for verification |
timeout | number |
optional timeout that overrides the default webdriver timeout |
Waits until the element's input value is equal to expected text, within timeout
Param | Type | Description |
---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' |
locator | string |
value of element to search, corresponding to locator strategy |
value | string |
expected input text value for verification |
Waits until a certain number of elements for the specified locator strategy is found, until timeout
Param | Type | Description |
---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' |
locator | string |
value of element to search, corresponding to locator strategy |
count | number |
expected number of elements |
Waits until the element's innertext value contains the expected text, within timeout
Param | Type | Description |
---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' |
locator | string |
value of element to search, corresponding to locator strategy |
value | string |
expected text value |
timeout | number |
optional timeout, overriding the global driver timeout |
Finds all elements with provided locator strategy and returns them as an WebElement array
Returns: *
- Returns the array of WebElementPromises if found;
Param | Type | Description |
---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' |
locator | string |
value of element to search, corresponding to locator strategy |
Function to scroll to the position of a specific element on the browser
Returns: Promise.<void>
- An empty promise
Param | Type | Description |
---|---|---|
element | WebElement |
Element to search on the target browser |
Function to validate whether an element is visible on the browser viewport (works on desktop/ios/android)
Returns: boolean
- Return true if found; or else, false
Param | Type | Description |
---|---|---|
element | WebElement |
Element to search on the target browser |
Select radio button identified by id locator strategy
Param | Type | Description |
---|---|---|
id | string |
Id value of the element based on 'id' locator strategy |
Select checkbox element identified by id locator strategy
Param | Type | Description |
---|---|---|
id | string |
Id value of the element based on 'id' locator strategy |
Waits for checkbox element to become visible and selectable, identified by id locator strategy
Param | Type | Description |
---|---|---|
id | string |
Id value of the element based on 'id' locator strategy |
Waits for checkbox element to become disabled, identified by id locator strategy
Param | Type | Description |
---|---|---|
id | string |
Id value of the element based on 'id' locator strategy |
Select an item in the dropbox element, identified by id locator strategy
Param | Type | Description |
---|---|---|
parentId | string |
Id value of the element based on 'id' locator strategy |
itemIndex | number |
index value of the dropdown values |
Waits for the page to complete loading/refreshing
Returns: Promise.<void>
- Returns true if page has successfully loaded
Throws:
Promise.<msg>
Returns an error if timed out
Waits until the URL contains the specified prefix
Param | Type | Description |
---|---|---|
prefix | string |
part of the url for verification |
Waits until the URL of the webpage matches the expected url value
Param | Type | Description |
---|---|---|
url | string |
entire URL string to be verifieds |
Opens a new tab with specified URL
Param | Type | Description |
---|---|---|
url | string |
URL to be opened |
Waits for new tab to open and callback is called on success
Param | Type | Description |
---|---|---|
callback | function |
callback function to be called after new tab is opened and validated |
Waits for element to become stale, until timeout
Param | Type | Description |
---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' |
locator | string |
value of element to search, corresponding to locator strategy |
Waits for element to be attached to the webpage and become visible, until timeout
Param | Type | Description |
---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' |
locator | string |
value of element to search, corresponding to locator strategy |
Get browser console logs
Returns: string
- - Entire browser logs in preserved state
Custome function to upload a file using an element, identified by specified locator strategy
Param | Type | Description |
---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' |
locator | string |
value of element to search, corresponding to locator strategy |
filepath | string |
path of the file to be uploaded |
Custom function to verify if element is stale and execute callback if yes; if not, fail with message
Param | Type | Description |
---|---|---|
strategy | string |
'id', 'name', 'className', 'xpath', 'css', 'tagName', 'linkText', 'partialLinkText', 'accessibilityId' |
locator | string |
value of element to search, corresponding to locator strategy |
fxName | string |
name of function |
error | Object |
error object with name parameter and message |
callback | function |
callback function to be called if error.name is StaleElementReferenceError |
Waits for cookie to be expected value
Param | Type | Description |
---|---|---|
title | string |
key name of cookie in browser |
Returns cookie value
Param | Type | Description |
---|---|---|
title | string |
key name of cookie in browser |
Waits for expected cookie to be cleared, until timeout
Param | Type | Description |
---|---|---|
title | string |
key name of cookie in browser |
Waits for cookie to be expected value, until timeout
Param | Type | Description |
---|---|---|
title | string |
key name of cookie in browser |
value | string |
expected value of cookie key |
Error Processor and throws error back up to the runner
Param | Type | Description |
---|---|---|
error | Object |
Must be an object so that the method can add additional fields |
errorStack | any |
Must be an object so that the method can add additional fields |