Choose file upload not working in ubuntu server

After my all robot code changes move to ubuntu server, then if i execute / run the file from shell script via
file upload is not working, Can you one can you pls share your suggestion ASAP. almost i spent 2 days :frowning:

Not enough information.

Create a sample block of code, with the similar steps you have, without any private info.


Hi @HelioGuilherme66

File name : upload.robot

*** Settings ***
Documentation Upload Testcase
Library SeleniumLibrary

*** Variables ***
${ONBOARD_BUTTON} xpath=//span[@class=‘mat-button-wrapper’]
${FIRST_FILE_INPUT} xpath=(//input[@type=‘file’])
${SECOND_FILE_INPUT} xpath=(//input[@type=‘file’])[2]
${FIRST_FILE_PATH} ${EXECDIR}/…/resources/json/GUI/config-file.json
${SECOND_FILE_PATH} ${EXECDIR}/…/resources/json/GUI/schema.json
${ONBOARD_SUBMIT_BUTTON} css=button.submit-btn[type=‘submit’]

*** Test Cases ***
Upload Test case
SeleniumLibrary.Click element ${ONBOARD_BUTTON}
SeleniumLibrary.Choose file ${FIRST_FILE_INPUT} ${FIRST_FILE_PATH}
SeleniumLibrary.Choose file ${SECOND_FILE_INPUT} ${SECOND_FILE_PATH}
SeleniumLibrary.Click element ${ONBOARD_SUBMIT_BUTTON}

${ONBOARD_BUTTON}  xpath=//span[@class='mat-button-wrapper']
${FIRST_FILE_INPUT}     xpath=(//input[@type='file'])
${SECOND_FILE_INPUT}    xpath=(//input[@type='file'])[2]

${FIRST_FILE_PATH}      ${EXECDIR}/resources/json/GUI/config-file.json
${SECOND_FILE_PATH}     ${EXECDIR}/resources/json/GUI/schema.json
${ONBOARD_SUBMIT_BUTTON}    css=button.submit-btn[type='submit']

I am execute the folder

i configered the upload.robot

Hi Natarajan,

invalid argument: File not found

This is probably a clue to what the problem is, I would guess it’s one of these that causing that error

${FIRST_FILE_PATH} ${EXECDIR}/…/resources/json/GUI/config-file.json
${SECOND_FILE_PATH} ${EXECDIR}/…/resources/json/GUI/schema.json

The first thing you can do is on the line before SeleniumLibrary.Choose file add a line that does Log ${FIRST_FILE_PATH} and one that does Log ${SECOND_FILE_PATH}

Now you can see what these got evaluated to.

My initial guess is you wanted ${CURDIR} not ${EXECDIR}, see Built-in variables for what the difference is.

You didn’t mention what OS you were running on when it was working? but not sure if that matters? you are using Ubuntu now and the path separators are correct for Ubuntu.

you said

Is this also how you executed the test on the other machine when the test was working?

  • if no, what were you doing differently on that machine?
  • is in the same folder as upload.robot and the resources folder?
  • is there a cd command in that changes to a different directory before running upload.robot?

Hopefully the suggestion and questions here will help you find your issue,


Hi @damies13 @HelioGuilherme66 now issue is fixed !!!, Thanks for your support…
in my robot file i added below line

SeleniumLibrary.Click element ${ONBOARD_BUTTON}
${Config_final_path} Normalize path ${FIRST_FILE_PATH}
${Suite_final_path} Normalize path ${SECOND_FILE_PATH}
SeleniumLibrary.Choose file ${FIRST_FILE_INPUT} ${Config_final_path}
SeleniumLibrary.Choose file ${SECOND_FILE_INPUT} ${Suite_final_path}
SeleniumLibrary.Click element ${ONBOARD_SUBMIT_BUTTON}