如何使用 'contenteditable' 属性 和 Laravel Dusk 编辑 div?
How can I edit divs with 'contenteditable' property with Laravel Dusk?
我的项目中有一个所见即所得的编辑器,我需要对其进行测试,它有一个 contenteditable
属性。我不能直接输入,因为它是一个简单的 <trix-editor>
标签:
<trix-editor input="28" placeholder="Type your message here..." contenteditable="" role="textbox" trix-id="2" toolbar="trix-toolbar-2">
</trix-editor>
如您所见,它具有 contenteditable
属性。当 运行 Selenium 测试并显示命令 edit content
时,我可以使用 Selenium IDE 轻松编辑它。
可以用 Laravel Dusk 做同样的事情吗?
您可以使用 keys()
编辑内容:
$browser->keys('[trix-id="2"]', 'Text')
我的项目中有一个所见即所得的编辑器,我需要对其进行测试,它有一个 contenteditable
属性。我不能直接输入,因为它是一个简单的 <trix-editor>
标签:
<trix-editor input="28" placeholder="Type your message here..." contenteditable="" role="textbox" trix-id="2" toolbar="trix-toolbar-2">
</trix-editor>
如您所见,它具有 contenteditable
属性。当 运行 Selenium 测试并显示命令 edit content
时,我可以使用 Selenium IDE 轻松编辑它。
可以用 Laravel Dusk 做同样的事情吗?
您可以使用 keys()
编辑内容:
$browser->keys('[trix-id="2"]', 'Text')