Relative path for files specified in desired capabilities

Hi there,

At the moment I’m using the following desired capability of Chrome --use-file-for-fake-video-capture=path to filename.y4m

The file has an absolute path outside of the project. I would like to include the file within the project but haven’t found a relative path I can use to do this.

It there any way to do this?



  1. Set the environment variable (
  2. Use the system environment variable as an anchor for relative path for files outside of the project:

String path = "${System.getenv('HOME')}/path_to_somewhere"

b) Use Run Configuration class ( with many methods that can get you some folder name (e.g. getProjectDir()).

I would also like to be able to use relative paths for file upload. In our case, the uploaded files are in the Data Files folder, relative to the project.

As a work-around, we have used the absolute path in a global variables (and overridden it when executing from the command line), but it would be far simpler to use a relative path.

Thanks for your reply. Would you explain a little more how you might do this with the RunConfiguration class? I’ve tried getProjectDir() before but it retrieves the path of the project only.

@Harold_Owen I don’t know about the uploaded files, but you know you can select relative path for the files in the Data Files folder, right?

Well, it depends on where is your video capture file. If it is under the project directory you could do something like "${RunConfiguration.getProjectDir}/files/video".

Otherwise, do what I said above (because I don’t know how to traverse the filesystem upwardly): "${System.getenv('HOME')}/Documents/files/video".

@Mate_Mrse, I do not recognize that File’s Information setting. I was referring to the WebUI Upload File keyword. When I do this
WebUI.uploadFile(findTestObject('Admin Application/CPE/Upload/BtnBrowse'), 'Data Files\\myfile.xml')

I get this exception
Root cause: org.openqa.selenium.WebDriverException: unknown error: path is not absolute: Data Files\myfile.xml

How about this?

    findTestObject('Admin Application/CPE/Upload/BtnBrowse'),
    "${RunConfiguration.getProjectDir()}/Data Files/myfile.xml"

@kazurayam, thank you very much, this worked!

WebUI.uploadFile(findTestObject('Admin Application/CPE/Upload/BtnBrowse'), 
RunConfiguration.getProjectDir() + '/Data Files/myfile.xml')

Hi @Mate_Mrse,

Sorry for the long over due reply.

I tried the following but didn’t have any luck. RunConfiguration.getProjectDir() gives me the right path when used in a test case script but when I try it when specifying desired capabilities like below it doesn’t retrieve the file.

In the List Property Builder dialog, the expression ${RunConfiguration,getProjectDir()} will not be evaluated to be the directory path. It will be seen just as a string constant “${RunConfiguration,getProjectDir()}”.

Rather you can write


./ means the current directory. As long as you execute your tests via Katalon Studio GUI, the current directory is equal to RunConfiguration.projectDir(). However you should note, when you run Katalon in Console mode the current directory should be different from the RunConfiguration.projectDir(), it will be the directory where Katalon Studio binary is installed.

Thanks @kazurayam, but I’ve tried this and haven’t had any luck. Has it ever worked for you in the past?

@Loan_Tran @Alice @Brian_Ducson It seems that @Bella needs a way to initialize desired capabilities programmatically. Is it possible with the current version?

1 Like

I think it is possible to initialize desired capabilites programmatically. Just exactly the same way doing with Selenium. Once it is init, create a driver and use DriverFactory.changeWebDriver() function to attached the new driver into Katalon Studio.

Thanks for your reply @Brian_Ducson, however I think this would be a bit of a hacky solution since this would force me to declare my desired capabilities in every test case I wish to use it in. This isn’t very maintainable. My goal in using relative paths was to make it more maintainable. I’ve logged the fact that Katalon cannot accept relative paths in desired capabilities as a bug.