Skip to content

Instantly share code, notes, and snippets.

@orendon
Forked from thijsc/gist:1391107
Created July 26, 2013 05:26
Show Gist options
  • Save orendon/6086512 to your computer and use it in GitHub Desktop.
Save orendon/6086512 to your computer and use it in GitHub Desktop.
def select_from_chosen(item_text, options)
field = find_field(options[:from])
option_value = page.evaluate_script("$(\"##{field[:id]} option:contains('#{item_text}')\").val()")
page.execute_script("$('##{field[:id]}').val('#{option_value}')")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment