Skip to content

Instantly share code, notes, and snippets.

@andreierdoss
Forked from strukturedkaos/gist:3801641
Last active December 21, 2015 13:39
Show Gist options
  • Save andreierdoss/6313962 to your computer and use it in GitHub Desktop.
Save andreierdoss/6313962 to your computer and use it in GitHub Desktop.
def select2 text, options
page.find("#s2id_#{options[:from]} a").click
find(:xpath, "//body").find("input.select2-input").set(text)
page.execute_script(%|$("input.select2-input:visible").keyup();|)
find(:xpath, '//body').find('ul.select2-results li', text: text).click
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment