Set relative path using send keys in Windows File dialog


I have to upload a file in the browser. When I click the browse button, the Windows File dialog opens.

I am using the below code:

Click Button Browse
Control Window Name:‘Open’ foreground=True
Send Keys keys={CTRL}{L}
Send Keys type:Edit name:‘Address’ D:\Robotic Invoice Processing\output\{Enter}
Send Keys type:Edit name:‘File name:’ Invoice.csv{Enter}

How can I set relative folder path or file path instead of absolute path using send keys for the Windows File Dialog.
Also, if the robot is using the Windows File dialog, can it be executed in the Control Room?

Thanks and regards

I’ve had difficulty with File Open dialogs in the past with Windows applications. One problem is that the File name edit box did not have a unique identifier, at least as far as I could see. I ended up with the following, which was to put into the clipboard the filename first and with the dialog opened, as the focus starts off in the filename edit box, paste it.

*** Settings ***
Library  RPA.Desktop.Windows
Library  RPA.Desktop

*** Tasks ***
Open File From Within Notepad
   Open executable   notepad.exe  Untitled - Notepad
   Menu Select    File->Open...
   # Set filename to open into Clipboard
   Set Clipboard Value    ${CURDIR}${/}HelloWorld.txt
   # Paste into Open File Dialog and press <enter>
   Send Keys To Input  ^v

I’ll note the Set Clipboard Value keyword comes from the RPA.Desktop library. I know this is not exactly your problem but hopefully this is helpful. I’ll also add there are a few methods for handling file upload within the browser, of which I have no real experience doing, but someone else might have a different approach that may also be helpful.

1 Like

Hi @deboleena.k,

It looks like you are trying to use the default output directory for your robot. If that’s the case you can try using the ${OUTPUT_DIR} variable (it’s a builtin variable that points to the robot’s output folder). We discuss that variable here: Collecting the results. If this doesn’t work for you let me know and we can try to find another solution.


1 Like

I could get the folder path using ${OUTPUT_DIR}