Skip to content

Instantly share code, notes, and snippets.

@styx
Forked from thijsc/gist:1391107
Created Feb 24, 2014
Embed
What would you like to do?
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