Reputation: 91
So basically I've started working with PageObjects and I'm having some issues.
I want to execute a command directly on some section. For example - I want to .waitForElementVisible
directly on section (not on elements). Is it even possible? I've tried a lot of combinations, for example:
browser.page.topMenu().section.loginBox.section.unauthenticated.waitForElementVisible('@loginTooltip', 10000)
So it looks like this: topMenu()
is my pageObject file, then there is loginBox
section containing -> unauthenticated
section containing -> loginTooltip
section. I want to .waitForElementVisible
on the last one section. How to do this? I know I can combine my sections without limitations, but how to work on them later on?
browser.page.topMenu().expect.section('@loginBox').to.be.visible
- this works - because it's only one section
browser.page.topMenu().expect.section('@loginBox').section('@unauthenticated').to.be.visible
- doesn't work - I want to check if section unauthenticated
which is inside loginBox
section is visible. How to do this?
Thanks in advance for all answers, I've tried to figure this out myself without any success.
Upvotes: 3
Views: 2119
Reputation: 11
The way to check if a section is visible should be:
loginBox.expect.section('@ unauthenticated').to.be.visible.before(1);
ref# NW github repository github pulllRequest
The high level commands only work with sections:. it is: asserts: visible, enabled, present.
Upvotes: 0
Reputation: 89
OK first let's break it down so it will be more readable:
var topMenu = browser.page.topMenu(); // Declare the page object.
var loginBox = topMenu.section.loginBox; // Declare the first section.
var unauthenticated = loginBox.section.unauthenticated // Declare the second section.
and so on...
Once you want to perform a command you can do:
loginBox.waitForElementVisible('@unauthenticated');
Note that the section selector should be declared:
sections: {
unauthenticated: {
selector: '.unauthenticated_title',
elements: {
sectionElements: '.selector_selector'
}
},
anotherSection: {
...
}
}
The second question is similar.
loginBox.expect.element('@ unauthenticated').to.be.visible;
Upvotes: 1