2

Is there any option in robot framework to upload a csv file ( or any kind of file ) from local machine ?

Here is my testing scenario -

While clicking on 'Upload file' button a new window will pop up ( It's not part of application, it's a common windows explorer(libraries) pop up menu - [Please refer screenshot] )

then, I have to upload a csv file from my system to our web application.

But am not able to do anything after pop up window appears in screen !

Is there any option to select the windows pop up menu using the keyword Select Window or any other alternative option ?

If it's possible, then how to specify the filename in the pop up window ?

Please help me to resolve this issue !

[ Note - I am using Selenium2Library & chrome browser ]

Any sample test case is more helpful.

[ I came to know that , using Choose File keyword we can achieve the same, but I couldn't find it's sample usage anywhere and this keyword will only work with Firefox . I cann't use firefox for this testing because of the issue which I mentioned here : Unable to handle google authentication window using firefox in robot framework ]

3

2 Answers 2

1

The solution is to use Choose File. You claim it only works on Firefox, but I use it on chrome regularly.

Assuming that your web page has an input element with an id of "file_input", and you have a file on disk named "/tmp/testfile.txt", you would use it like this (in pipe separated format for clarity, but you can use any format):

| | Choose file | id=file_input | /tmp/testfile.txt
2
  • Thanks for the solution ! But I would like to know one more thing.. The file explorer window will pop up when clicking on a particular button in my web application... As per your solution I have to specify the the 'id' of the input element ! So, do I have to specify the 'id' of that particular Button ? Commented Oct 11, 2015 at 5:24
  • @ArunRamachandran: not the button. You specify the id of the <input> element that will get the filename. You shouldn't be clicking the button, call Choose File instead of clicking the button. Commented Oct 11, 2015 at 12:27
0

If you want to upload file using the Windows explorer then you need to use AutoIT with Selenium, this will simulate your windows action.

You should try using the ChooseFile function for uploading the file directly. Refer to these link (Link 1 and Link 2) for more details.

1
  • Do I have to include any other tool for uploading file using centOS file explorer ? Can I make use of AutoIT for uploading file in centOS also? Commented Oct 11, 2015 at 5:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.