Skip to content

Instantly share code, notes, and snippets.

View zedtux's full-sized avatar

Guillaume Hain zedtux

View GitHub Profile
@zedtux
zedtux / wysihtml5_helpers.rb
Last active May 17, 2017 18:19 — forked from bguthrie/fill_in_wysihtml5.rb
A Capybara helper to fill in WYSIHTML5 editors. Works with multiple editors on a page.
module FillInWysihtml5Helpers
def fill_in_wysihtml5(label, options = {})
page.execute_script <<-JAVASCRIPT
var id = $("label:contains(#{label})").attr("for");
$("#" + id).data("wysihtml5").editor.setValue("#{options[:with]}");
JAVASCRIPT
end
def read_wysihtml5(label)
page.execute_script <<-JAVASCRIPT