Skip to content
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

TO DO - ADD EXAMPLES FOR THESE

  1. Sections can find the right thing
  2. Sections can be pluralized
  3. Sections can be nested
Clone this wiki locally