Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.7k points)

How can I fill a CKEditor area within Capybara, assuming I'm using a javascript capable driver like capybara-webkit or selenium?

1 Answer

0 votes
by (62.9k points)

Here's a solution in which by using javascript both to set the data on the hidden textarea and on the CKEditor object.

def fill_in_ckeditor(locator, opts)

  content = opts.fetch(:with).to_json # convert to a safe javascript string

  page.execute_script <<-SCRIPT






# Example:

fill_in_ckeditor 'email_body', :with => 'some message!'

Browse Categories