How to set text into Summernote textarea with Capybara + Poltergeist

前端 未结 2 413
借酒劲吻你
借酒劲吻你 2021-01-19 14:20

I have a textarea which is using Summernote and I set onChange event to it. I want to write test with RSpec + Capybara + Poltergeist to confirm the onChange event is working

2条回答
  •  孤街浪徒
    2021-01-19 14:54

    Capybaras fill_in only works with html form elements. Since the JS version of your page is using a DIV with the contenteditable attribute as its text area to be filled #fill_in will not work. Instead you need to find the div and call #set on it directly. In your project the following should work

    find('div[contenteditable]').set('This is awesome blog.')
    

提交回复
热议问题