-
Notifications
You must be signed in to change notification settings - Fork 6
5 Element Actions
Titus edited this page Jan 27, 2018
·
1 revision
Watir Drops provides a few convenience features for interacting with form elements.
In addition to being able to pass in #set
to a Radio element, #select
to a Select element, and #click
to a CheckBox element, etc, you can populate data directly with an equals sign.
class Foo < WatirDrops::PageObject
element(:foo) { browser.check_box(id: 'foo') }
element(:bar) { browser.text_field(id: 'bar') }
element(:foobar) { browser.select_list(id: 'foobar') }
def do_things
self.foo = true
self.bar = 'Text Details'
self.foobar = 'Desired Option'
end
end
Similarly, the default return value of an element (often getting #text
, but sometimes #value
or #set?
, etc) can be obtained by appending a bang: bar! # => "Text Details"