Skip to content
This repository was archived by the owner on May 8, 2024. It is now read-only.
Sean Gregory edited this page Oct 9, 2021 · 2 revisions

Form handling

text field

field = browser.text_field(id: "first-name")
field.set("Sean")
field.value # Sean

radio

radio = browser.radio(id: "radio")
radio.selected? # false
radio.select
radio.selected? # true

checkbox

checkbox = browser.checkbox
checkbox.checked? # false
checkbox.check
checkbox.checked? # true

select list

select_list = browser.select_list(id: "states")
select_list.select(/^United States/)
select_list.value # United States of America

# or 

option = select_list.options.find do |option|
  option.value == "US"
end

select_list.select(option)

Clone this wiki locally