mercredi 26 août 2020

Testcafe - Unable to upload files with input type="url" which is a react custom made file upload component

I am trying to upload a file but getting error "The specified selector does not match a file input element", I know testcafe requires input type="file" for uploading files, But as we are reusing our custom component for file uploads where we are giving input type="url" It's not working with testcafe.

Here is the java script/HTML code

<input name="images" accept="image/*" type="url" class="form-control col-11 false" value="">

And I am trying to access the css selector like this

const click_add_image=Selector('input[name="images"]')
const add_image=Selector('input[name="images"],input[inputtype="url"]')

test
    ('add images', async t=>{
        await t
            .click(click_add_image)
            .wait(2000)
           .setFilesToUpload(add_image,[
           './_uploads_/Share_Knowledge.png'
            ])

I am getting error The specified selector does not match a file input element

Aucun commentaire:

Enregistrer un commentaire