0

I have a Robot Framework test case that makes use of the following variable:

${download_dir}    C:\\users\\myProfile\\Downloads

How can I change this so that it always points to the Downloads folder on any computer? It is assumed that the test cases will only be run on Windows computers.

1

1 Answer 1

3

To simplify the link I sent to the comment section:

*** Settings ***
Library    OperatingSystem

*** Test Cases ***
Get User Home
    ${user_home}=    Get Environment Variable    UserProfile
    Log To Console    ${user_home}\\Downloads 

In Windows, there's UserProfile environment variable that resolves to e.g. C:\Users\PavelSaman, so you can just get its value in RF and append \Donwloads to it.

Your Answer

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

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