Situation is: With Browser Library keyword “Browser.upload file by selector” it is not possible
pick up up the file from path: ${CURDIR}/dubbel_check.jfif
I use the following code:
*** Variables ***
${Add_Choosen_File} ${CURDIR}/dubbel_check.jfif
${UploadFiletest} //input[contains(@type,‘file’) and contains(@id,‘uploadPhotoMulti’)]
*** Keyword***
Upload Pic in Browser Run Keywords
Browser.wait for elements state ${UploadFiletest} state=enabled timeout=60
… AND BuiltIn.sleep 1
… AND Browser.Execute JavaScript window.frames[0]; document.querySelector( “input[id=‘uploadPhotoMulti’]” ).style.display = “block”
… AND BuiltIn.sleep 1
… AND Browser.upload file by selector ${UploadFiletest01} ${Add_Choosen_File}
… AND BuiltIn.sleep 1
If I use a wrong path it just states that I have a “Nonexistent input file path”, so I guess that is not the issue.
Looking at your code it seems your test steps end after adding the file and sleeping for a second. Do you need to press “Bevestigen” to actually upload/store the file?
Ok,
I also had that thought, that the file in the PATH is correct
The repro-steps are:
Step 1. I Execute a Java script, so you have the option to choose a file
Step 2. Then upload file from path with keyword “Upload File By Selector”
Step 3. Wait for file to be successfully uploaded
Step 4. Enter a number in the element field “Quantity”
Step 5. After you have entered a number, you can only click on “Bevestigen”
JavaScript I use is:
Browser.Execute JavaScript window.frames[0]; document.querySelector( “input[id=‘uploadPhotoMulti’]” ).style.display = “block”
Hi,
In addition to the solution: The reason it didn’t work is because robot framework’s browser library uses the node js version of playwright. Before a file is tried to be uploaded, the mime type is checked. So check if the mime type of the file exists in Common MIME types - HTTP | MDN,
Otherwise the file will not be uploaded.