How to create folder for images in current working directory

I am supposed to upload images to the application. I wanted to create a folder which contains images. And the path of images would be passed in setText method as current working directory. So that other testers can clone the code and execute testcases without making any changes.

You can create a new folder simply using Windows File Explorer, Total Commander or other tool. :slight_smile:

Just navigate to your project’s folder and create a new one inside. You’ll get its path using my code above. It is relative path (not dependent on local machine), so it would work also when you move your project to other machine.

Hey,
How can I create a folder ‘images’? I’ve created in workspace but it’s not showing up in the project explorer.
I also created a folder in Datafiles and added images to it from the workspace but still it’s not showing up in project explorer

Hello, create folder images in your project folder and add this code:

def imgDir = RunConfiguration.getProjectDir() + "\images"

imgDir contains absolute path to images folder (e.g. C:\Katalon\MyProject\images)

I tried using RunConfiguration.getProjectDir() and found i needed the following package

import com.kms.katalon.core.configuration.RunConfiguration

See https://api-docs.katalon.com/com/kms/katalon/core/configuration/RunConfiguration.html

Once that was imported the script ran fine.

Any idea how to do this in Katalon recorder?

How to upload txt file from project in linux environment. I struct here
WebUI.delay(5)

//WebUI.click(findTestObject(‘NewLoanPage/Page_LOS LendGenuity/DropfilesHereToUpload’))

def imgDir = RunConfiguration.getProjectDir() + “/images/DITestCaseC01FixedPrimaryAttachedBW012012.txt”

WebUI.click(findTestObject(‘NewLoanPage/Page_LOS LendGenuity/DropfilesHereToUpload’), imgDir)

WebUI.delay(5)

WebUI.uploadFile(findTestObject(‘NewLoanPage/Page_LOS LendGenuity/DropfilesHereToUpload’), imgDir)

WebUI.delay(5)

This is not working

Any details?