Forum Discussion

bscherzer's avatar
bscherzer
New Contributor
5 years ago

Changing Downloads path in Chrome browser

Hello,

 

Any recommendations on changing the Downloads folder in a Chrome browser via TestComplete? The default points to the Downloads folder on my local machine (which includes my Windows username in the file path). At the beginning of the test, I'd like to change this Downloads folder so that this test can run on other machines.

 

Thanks in advance for any help!

 

Brandon Scherzer

  • Thanks a lot for the suggestions and help! We are going to modify the download folder on our machines that will run this automation in lieu of writing code to do this. We may circle back later and apply the code, but until then, our QA group was fine with creating a specific folder on our machines so the tests will run.

  • cunderw's avatar
    cunderw
    Community Hero

    Another solution is to use Sys.UserName to get the current username and build your path to file with that.

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Thank you everyone for advice! 

       

      bscherzer It is great to hear you found a solution, thank you for sharing this. 

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    In some research out there, Chrome actually "protects" from scripting the change of that folder.  So, this sounds like something you might need to do in environmental prep on your workstations.  

     

    What I would recommend is that, in Chrome settings on all machines you intend on executing automation, set it o prompt for download location and then script for that rather than just accepting the default.

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Thanks a lot tristaanogre for suggesting the workaround! 

       

      Hi bscherzer , did you have a chance to apply the suggestion? 

      I have another one you might find helpful – there's a way to download files from the Internet and specify the folder you need. Please refer to this article for details. 

       

      Let us know how it goes! :smileyhappy:

  • bscherzer's avatar
    bscherzer
    New Contributor

    Thanks a lot for the suggestions and help! We are going to modify the download folder on our machines that will run this automation in lieu of writing code to do this. We may circle back later and apply the code, but until then, our QA group was fine with creating a specific folder on our machines so the tests will run.