This is an instance of selenium-webdriver.WebDriver
.
Thus, you can consult the selenium-webdriver
API docs for complete details.
This is the set of convenience methods provided by the nemo-view
plugin, included with nemo.
Reference for the argument/return types
Type | Description |
---|---|
locatorDefinition |
Full details |
locatorObject |
Full details |
WebElement |
an instance of selenium-webdriver.WebElement
|
parentWebElement |
an instance of selenium-webdriver.WebElement
|
Method | Resolves | Notes |
---|---|---|
_find(locatorDefinition[, parentWebElement]) |
WebElement or rejected |
|
_finds(locatorDefinition[, parentWebElement]) |
[WebElement ] or rejected |
|
_present(locatorDefinition[, parentWebElement]) |
true or false
|
|
_visible(locatorDefinition[, parentWebElement]) |
true or false . Rejected if element is not found |
|
_wait(locatorDefinition[, timeout [, msg]]) |
true or rejected |
|
_waitVisible(locatorDefinition[, timeout [, msg]]) |
true or rejected |
|
_optionValue(locatorDefinition, value [, parentWebElement]) |
reject if unable to perform | |
_optionText(locatorDefinition, value [, parentWebElement]) |
reject if unable to perform | |
_firstVisible(locatorObject[, timeout]) |
resolves to the found key or rejected | Full details |
These methods are generated for each locator in each locators JSON file, when a locator directory is specified to nemo-view
. E.g.
"plugins
": {
"view": {
"module": "nemo-view",
"arguments": ["path:locator"]
}
},
And with associated directory and files:
<nemo base directory>
|- locator
|- bank.json
|- card.json
|- login.json
|- nav.json
You will get back a set of locator methods under the following namespaces:
nemo.view.bank
nemo.view.card
nemo.view.login
nemo.view.nav
They can be used as follows:
describe('PayFriend payment methods', function () {
beforeEach(async function () {
let nemo = this.nemo;
let {nav, login, card} = nemo.view;
await nemo.driver.get(nemo.data.baseUrl);
await nav.jsLoaded.wait();
await login.email().sendKeys('me@mine.com');
await login.password().sendKeys('p4w3rD!');
await login.button().click();
await card.form.waitVisible(3000);
});
afterEach(async function () {
let nemo = this.nemo;
let {nav, login} = nemo.view;
await nav.logoutLink().click();
await login.form.waitVisible(3000);
});
it('adds a credit card', async function () {
let nemo = this.nemo;
let {card} = nemo.view;
await card.form.waitVisible(5000);
await card.ccn().sendKeys('4141545465654343');
// do we have the CC type dropdown?
if (await card.cctype.present()) {
await card.cctype.optionValue('Misa');
}
await card.button().click();
await nemo.view._waitVisible('.result.good', 5000);
});
});
Here are the generated helper methods per locator:
Method | Arguments | Resolves | Notes |
---|---|---|---|
{locator} |
none |
WebElement or rejected |
|
{locator}By {locator}.by
|
none | JSON locator object | |
{locator}Present {locator}.present
|
none |
true or false
|
|
{locator}Wait {locator}.wait
|
timeout {Number} (optional) : time to wait in millisecondsmsg {String} (optional)
|
WebElement or rejected |
|
{locator}WaitVisible {locator}.waitVisible
|
timeout {Number} (optional) : time to wait in millisecondsmsg {String} (optional)
|
WebElement or rejected |
|
{locator}Visible {locator}.visible
|
none |
true or false if element present. rejected if not present |
|
{locator}OptionText {locator}.optionText
|
text {String} : the text of the option you wish to select |
rejected if unable to perform | |
{locator}OptionValue {locator}.optionValue
|
value {String} : the value of the option you wish to select |
rejected if unable to perform | |
{locator}TextEquals {locator}.textEquals
|
text {String} : expected value of element text |
true or rejected |
|
{locator}AttrEquals {locator}.attrEquals
|
attribute {String} : name of attributevalue {String} : the expected value of the attribute |
true or rejected |