Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testcafé - getting content of invisible <input>'s value attribute

I need to get the value of an <input>, specifically the stuff that is held inside its value attribute.

However, the input is not visible, so that seems to be a problem for testcafé.

Does anyone know how to work around that? Is there a special option you can use with the Selectors to make it work?

Thanks for helping me out, I appreciate any help!

like image 629
fweidemann14 Avatar asked Dec 24 '22 14:12

fweidemann14


1 Answers

Got it, simply declare a Selector like this let yourInputs = Selector('input[type="hidden"]'), this will get all hidden inputs and return a NodeList which you can iterate over in your test.

If you want to be more specific and select over an ID or name, do it like @lumio.

Then you can access the value in your test run with an await yourInputs.value.

like image 138
fweidemann14 Avatar answered Dec 28 '22 11:12

fweidemann14