To record a file upload operation or execute a test that involves uploading a file, an input element with the type attribute set to file must exist in the DOM tree under test. (1)
(Please see the reference articles below for more information on recording file uploads, input elements, and DOM trees.)
The following are the possible causes if a file upload operation isn’t recording correctly, or the test fails even if it is correctly recorded.
Causes and solutions
Test execution fails. (The test can be recorded.) |
The input element’s position has changed due to an update to the page/application under test. Therefore, the input element cannot be found during test execution. |
Re-recording the Test Scenario may solve the issue. |
Recording fails. (Therefore, the test cannot be run.) |
The input element has not been added to the page’s DOM tree, so it cannot be found. |
Autify does not support such cases. Please add an input element to the DOM tree to record and run tests. |
Recording and test execution become unstable. (Sometimes it succeeds, sometimes it fails.) |
The input element is dynamically generated or added to the DOM tree only during file upload operations. Therefore, it can only be found at specific times. |
You may be able to solve the issue by recording the event that causes the input element to be generated and added. E.g., adding a “Click the Upload File button” step. |
Phenomenon |
Possible Cause |
Solution |
Note
- You can set the input element as invisible through style settings as long as it has been added to the DOM tree.
Reference articles
- Can I test file uploads?
- Further information on <input type="file"> (Goes to MDN Web Docs)
- Introduction to the DOM (Goes to MDN Web Docs)
Please contact us via Autify chat if these solutions don’t work for you.