Skip to content

Instantly share code, notes, and snippets.

@bguthrie
Last active May 17, 2017 18:10
Show Gist options
  • Save bguthrie/5750066 to your computer and use it in GitHub Desktop.
Save bguthrie/5750066 to your computer and use it in GitHub Desktop.
A Capybara helper to fill in WYSIHTML5 editors. Works with multiple editors on a page.
module FillInWysihtml5
def fill_in_wysihtml5(label, opts={})
page.execute_script <<-JAVASCRIPT
var id = $("label:contains(#{label})").attr("for");
$("#" + id).data("wysihtml5").editor.setValue("#{opts[:with]}");
JAVASCRIPT
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment