0

We are trying to upload file using TestCafe code, but its not uploading the file. There's no IFrame. The input control is inside simple div>label structure

Kindly suggest. Thanks

<div>
<label>
  <div>..svg stuff..</div>
  <input aria-label="Upload an image" tabindex="0" type="file" multiple="" accept="image/jpeg, image/png" data-testid="imageInputTest" class="ImageInputstyles__Input-sc-7878w-7 aosVy">
</label>
</div>

Code snippet:

fixture `Example`
.page `https://ourURL.com/YOUR PATH/`;

test('Upload Files test', async t => { await t .setFilesToUpload('.dx-fileuploader-input', 'path/to/file_to_be_uploaded/on/your/machine' ]); });

We also checked that- its not uploading to the server. More ref: https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/setfilestoupload.html

1 Answer 1

2

try

await t
        .setFilesToUpload(Selector('input').withAttribute('type', 'file'), [
            path
        ]);
Sign up to request clarification or add additional context in comments.

1 Comment

You can see a detailed description of how to test file upload in TestCafe and inspect a runnable example here.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.