Hi, guys. Could you help me with this issue? I have two scenarios here:
1 - I’m using choose file xpath/class ${path} in a field that a can select only one image. In this particular case, to change the background of the page, and it is working perfectly. I have a input field where the image is stored.
2 - I have have a button to upload one or more images, so it is a list. The list will be only showed when i sent the fist images. I used the same method of the first case, using choose file and the log says that i have sent the image, but it wasn’t. I think this is happening because its is a list, right? In this case, i don’t have a input field, only
with the image.
** wait until element is visible class:btn-anexar**
** Choose File class=btn-anexar ${EXECDIR}/Assets/Img/Led.png**
** Log To console worked**
in this attemp, i’m trying to store the button. it is just to show to you guys that i tryed with the list components and I didn’t get result.
I assume that the image was correctly uploaded, but the next action to trigger the showing of the image did not happen.
Usually, the user clicks on the button and that should trigger the call of other functions or changes in variables. There could also be a problem of timing. You send the image and the you test if it was visible. Maybe this is too soon.
You should try to make some action, for example Mouse Down on a element related to the image.
Other problem that can happen, is to send the file to a different element. You are using a class as selector, but Choose File may be just using the first element it found. You should try to see if there are more elements of <input type=‘file’ … > and use a better locator if that is the case.
Choose File does NOT address the button that triggers the upload.
You have to select the <input > element that will contain the path to that file after it is chosen.
Somewhere in the page, there is an input element to receive the file. You need to track the actions of that button that will make the connection to the input element.
Generally I would agree with @HelioGuilherme66 on this, there really should be an input of type file hidden somewhere in the html page.
I have however once seen an exception to this where the upload button actually triggered a file selector from javascript and then did the upload via a webservice call and once successful used used a callback to update the page to show the filename as uploaded. Now this is NOT standard html or standard anything really but I did see it once.
I suggest you load the page, open dev tools (typically F12) to the network tab, clear the network tab and then upload a small file and see what network traffic is generated, inspect the post data of all your posts, and this should give you a clue to how the files are being uploaded.
Once you know what the browser does manually then you can plan an approach to automate it.
Hi all, just for documentation I was facing the same issue. To activate my Save button, I needed to have choose a file. Just using “Choose file” was not working.
To fix it I first used the “Choose File” and then, right after use the Input “file_path”. Just doing 1 or the other was not working
If you’re dealing with a page that doesn’t use an input element then it’s something non-standard, there will be no out of the box answer, you will need to figure out how your application works and then how to get the automation to trigger the same behaviour.
We can’t help you without knowing how the custom solution your developers made works.
If it can be publicly accessed then post a link and we can have a look, but you might be better off raising a defect on the upload field for not being HTML standards complaint, if that’s something your organisation cares about.
I have the same issue with Choose file keywords, I precise the input that has the type “file” and I’m sure that the path is correct, but when running the test choose file pass without uploading the file.Could be any other reason for this behavior?