Files
astuto/spec/support/select_by_value.rb
2023-04-12 18:35:39 +02:00

8 lines
320 B
Ruby

# Helper used to select an option from a select box by its value (rather than by its text)
# Taken from: https://stackoverflow.com/a/15821255/1857435
def select_by_value(id, value)
option_xpath = "//*[@id='#{id}']/option[@value='#{value}']"
option = find(:xpath, option_xpath).text
select(option, :from => id)
end