Choose file not working properly

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.

    the next step isn’t working because the image was not sent to the page…

    Can you understand me? I’m still learning english :wink:

  • Hello,

    Your English is fine.

    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.

    Hi,

    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.

    https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Choose%20File

    Inputs the file_path into the file input field locator .

    Hi, guys. I asked to the developer change de to and worked. :slight_smile: thank you.