0

I'm using Robot Framework, And I have an issue concerning uploading a file when a popup is displayed and I need to select a file to be uploaded.

When I click on upload a popup is displayed to select a file from the computer. Did anyone try to handle this issue and how.

Please find the popup attached.

Thanks in Advanceenter image description here

Narek Hakobyan
  • 107
  • 2
  • 4
  • 13
  • 1
    Use the `Choose File` keyword instead if you can. As that will directly upload the file instead of opening up the file browser. http://robotframework.org/Selenium2Library/Selenium2Library.html#Choose%20File – Goralight Jun 26 '17 at 09:00
  • Isn't there another way? Because that doesn't work. The Element where the path must be written is disabled, and is enabled only when the file is selected – Narek Hakobyan Jun 26 '17 at 11:19
  • Then you may have to use `AutoIt` but it's not the easiest thing in the world to set up – Goralight Jun 26 '17 at 11:28
  • Yes, that's the last point I want to get into :) – Narek Hakobyan Jun 26 '17 at 11:39

1 Answers1

0

An alternative approach is to use keyboard key strokes to move through the file picking. On Windows the SendKeys module will allow you to do that. For more on this see this SO answer.

A. Kootstra
  • 6,827
  • 3
  • 20
  • 43
  • Hi, so how do I add this to RobotFramework? Should I import the library? – Narek Hakobyan Jun 27 '17 at 07:02
  • The simplest way is indeed to save the example as a `name_of_library.py` and then add `Library name_of_library.py` (assuming it's in the root of your project). Create the Python methods using the SendKeys module and then call these functions as Keywords from Robot Framework. – A. Kootstra Jun 27 '17 at 15:54