naneri
naneri

Reputation: 3971

How can I edit divs with 'contenteditable' property with Laravel Dusk?

I have a wysiwyg editor in my project, that I need to test and it has a contenteditable property. I cant type directly, as it is a simple <trix-editor> tag:

<trix-editor input="28" placeholder="Type your message here..." contenteditable="" role="textbox" trix-id="2" toolbar="trix-toolbar-2">
</trix-editor>

As you can notice, it has contenteditable attribute. I can edit it easily with Selenium IDE when running Selenium tests and it shows command edit content.

Can the same be done with Laravel Dusk?

Upvotes: 1

Views: 639

Answers (1)

Jonas Staudenmeir
Jonas Staudenmeir

Reputation: 25906

You can edit the content with keys():

$browser->keys('[trix-id="2"]', 'Text')

Upvotes: 1

Related Questions