david001's avatar

Dusk: How to type in textarea?

Hi, I have a texture with Id as below

<textarea id="note" rows="3"></textarea>

I am using $browser->type("#note","This is my note"); type is not working for this

Is there any way to do this or any alternative ways with js

Thanks

0 likes
3 replies
SilenceBringer's avatar

@david001 from docs

If a CSS selector is not provided, Dusk will search for an input or textarea field with the given name attribute.

so, what if you will try

<textarea id="note" name="note" rows="3"></textarea>

and

$browser->type("note","This is my note");
david001's avatar

we are not modifying the files otherwise I would put the name.

can I do it with js like document.getElementBy(id).innerHtml="some text" How would this look if i try with js? Thanks

SilenceBringer's avatar

@david001 just checked the docs, really it should accept the id as the first param. possible you have multiple elements with the same id?

Another reason: possible element added dinamically and it's not exists on the page when you try to type? This way just try to add pause before typing

What's the error in your case?

Please or to participate in this conversation.