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.
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.
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
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()}”.
./ 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.
@Loan_Tran@Alice@Brian_Ducson It seems that @Bella needs a way to initialize desired capabilities programmatically. Is it possible with the current version?
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.