Setting file download path for Selenium Tests in TeamCity

Hi All,

I am running Selenium Tests on TeamCity 8.0.5 version. I am facing issue when I am trying to download some file to any path on Teamcity Server from website, but the file is not downloaded on Teamcity server rather it is downloaded on machine where my browser is running. However it works perfect when I run my tests through IntelliJ or command line. I am using Selenium Remote Webdriver.

Selenium RemoteWebdriver is on machine "abc" where my browser is executing tests.

TeamCity is installed on some other machine. I am accessting teamcity with URL and invoking my tests via a separate branch created as a maven project.

In my code, I have given download path as :

String downloadPath =  System.getProperty("user.dir")+"\\target";

So whenever I download something from my application say any image or pdf file, it is downloaded as a zip file at the above mentioned location.

But when I am trying to access my downloaded files through code as :

private String downloadPath =  System.getProperty("user.dir")+"\\target\\";
private String basketDownloadPath =  System.getProperty("user.dir")+"\\target\\";

I get FileNotFoundException and the files are actually downloaded on the machine where my browser is running , though the code is running from TeamCity agent as a checkout, so the downloaded file  should be present on Teamcity machine, but it is not there.

Please suggest what should I do, my tests are failing.

I am also attaching Build log as well.



1 comment
Comment actions Permalink


Have you tried to run your build on the same machine as the TeamCity agent and under the same user that the agent is running via console? Steps to reproduce are described here.


Please sign in to leave a comment.