If you use the Click and upload file command, you can use files registered on MagicPod in advance for the file upload test.
1. Upload files to MagicPod
If you add the command and click the Select file button,
the file selection/registration dialog box shall be displayed, so where necessary, register the file. (Maximum upload size is 52MB)
When the web page you are testing supports multiple file uploading, you can select multiple files to upload on MagicPod.
Additionally, the uploaded files are shared on a project basis, so you can select those files in different test cases within the same project.
2. Specify UI element for file upload
Please specify the UI element in Drop UI element.
In case of a browser's standard file upload button
When using the standard browser (although it depends on the browser, the file upload button has the following kind of design. The type attribute is a file input element), the button and the file path name area to its right are combined into one element.
You can upload the file by selecting this element as the UI element in the Click and upload file command, and selecting the file you wish to upload.
In case of a originally uploaded file upload element
On many sites, specially designed file selection buttons are implemented instead of the standard browser buttons described above. For example, even with MagicPod, an original file selection button is used for the file selection and registration described above.
As it is not possible to operate the button in this case, run a command in relation to the input elements with the type attribute compatible with the file upload area.
Basically, if you specify button elements in the same way as in In case of a browser's standard file upload button (“Choose a file to upload” button in the above figure), MagicPod automatically searches for the necessary input elements. However, it may be difficult to determine this automatically depending on the HTML structure of the website. If the following kind of message is displayed, specify the locator manually after checking the candidates displayed in the message.
key=xpath, value=//input[@name='foo'] is a candidate but is very different from the originally selected element
key=id, value=foo and key=id, value=bar are candidates, but it was not possible to select one as both were closest to the originally selected elementAdd the file selection button locator, according to the Defining an original locator guide. With the input content, the upper level (key) is the error message key, and the lower level (value) is the error message value. In case a second message is displayed, and it is not clear what the correct element is, or the candidates are not displayed, search for the correct element by confirming with the development team, etc.
Limitations
- For backward compatibility, if the target element itself or a nearby element is an
<input type="file">, the value will be set directly on the input element without triggering a click.
Since no click event is fired when the value is set directly, any behavior implemented in response to a click may not work as intended. - For input elements that are dynamically generated through button clicks and other actions, we only support Chrome/Edge browsers. Other browsers, such as Firefox, currently have technical constraints that make support difficult.
- (Future development plan) Processing of opening a file upload dialog using dynamically generated input through button clicks
Troubleshooting
Upload fails only when running in the local environment
Please check the MagicPod Desktop app's browser access permissions to folders.
If you are using a Mac, go to System Settings > Privacy & Security > Files & Folders and enable access permissions for MagicPodDesktop.app.