TestProject Forum
Powered by leading experts in the test automation community

Browse file from local storage after “Upload” button click

Hello,
I have an issue with the File Uploader Addon, it’s not working the way I read in its docs.
When I put the XPATH of the upload button and I run the action it just opens the file explorer
in windows to choose the file I want to upload, but when I search in the forum I find this topic:

and the moderator amit yahav told the user to use this XPATH: //input[@type = ‘file’]​.
and it worked for me very well, but the issue is that I need to upload 2 files on the same page, there is two upload button, the first one it worked with this XPATH: //input[@type = ‘file’]​ but the second one I didn’t find a way to make it work.
Thanks.



Hello @setouani.

This addon uploads files to input type elements, the XPATH you are using does not point to such an element.

If you use the XPATH:
//*[@type = ‘file’]
You will see that there are actually 3 of these elements on the page.

The second one is the element you are looking for, you can get the second element using the following XPATH:
(//*[@type = ‘file’])[2]​

Please create the step as I describe here:

Create the file upload element action on that button:

Edit the locator:

Change it to the following:

1 Like

wow thank you so much I followed exactly all the steps you said and it works, but it worked with (//input[@type = ‘file’])[2] not (//*[@type = ‘file’])[2] just want to clarify for other users.
Thanks

2

1 Like