-
Notifications
You must be signed in to change notification settings - Fork 6
9. Page Sections
Titus edited this page Jan 27, 2018
·
3 revisions
Sections tend to have two different use cases. One is to encapsulate a standalone widget of some sort that needs to be "name spaced" in some fashion. The other case is for dealing with like items in a list of items.
Either way, the section is defined the same way: specify the name and the associated section class, then pass in the pattern of the section that is to be matched.
section(:address, AddressSection) { browser.li }
In this example AddressSection
class would inherit from PageSection
and use base
as the scope for defined elements:
class AddressSection < WatirDrops::PageSection
element(:first_name) { base.span(id: 'first_name') }
end
This can then be accessed as follows:
address = AddressListPage.visit.address
expect(address.first_name.exist?).to eq true
- Sections can find the right thing
- Sections can be pluralized
- Sections can be nested