1

I have excel importer in my application when I click on the "Upload" button I will get a pop up window with file upload screen where I can select the excel from the specified path. How to handle this in Robot Framework? Can any one help me how to handle the case?

2 Answers 2

2

Selenium2Library provides Choose File keyword for the same.

It takes two arguments, first is locator for the button and second is path to the file which needs to be uploaded.

e.g.

Choose File xpath=.//div/input  ${TEMPDIR}${/}file_pa.csv
Sign up to request clarification or add additional context in comments.

2 Comments

Link-only answers are highly discouraged here because the links may become dead in the future. I suggest you edit your answer with quotes from the sources you cite
You can upload a file using "Choose File" Keyword, but you need to find locator that has a property "input".
0

If you're using a dialog or input that WebDriver can interact with, then Sachin's answer about Choose File is the way to go.

If you're talking about the pre-HTML5 file-chooser dialogs provided by the browser, then Selenium2Library can't do this. However RobotFramework isn't just a wrapper around Selenium2Library so you can use something else that allows you to interact with the file upload screen.

I've done it in the past using AutoIt.

If you're not explicitly testing the upload dialog (and why should you, since it's provided as an atomic widget by your browser) then you should consider ways to simply avoid it. Perhaps a simple rest interface for uploading files.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.