Search code examples
seleniumsymfony4behatmink

How to enter in textarea in WYSIWYG editor in behat


I'm trying to insert text into a textarea with a wysiwyg editor (summernote) from a form, i'm using behat featurecontext file for this. The textarea doesn't have a id tag so i need to select the class using javascript code: document.getElementsByClassName('note-editing-area').item(0).innerText="something"

But when i do this, also the innerhtml is overwritten with the text from innerText.

Any suggestions?


Solution

  • Best way is to set an id or class and select that. If you do not use that it is way more difficult to maintain. You could add this through twig:

    {{ form_widget(form.task, {'attr': {'class': 'task_field'}}) }}