How to Capture Screenshots of Web Elements for Image-based Testing

This is a companion discussion topic for the original entry at

Looks really interesting but does path have to be absolute? The location shown in the screenshot points to the Dev’s personal folder and will break when anybody else runs it.

@ThanhTo (not sure if you are the right person to tag)

I am also curious on the absolute path question @Dan_Bown posted but with a little twist. How does this function/work for someone who is using TestOps and running on remote devices? Does the file need to be stored somewhere remote? or does it upload with the repo when it goes to TestOps?

Thanks in advanced!

  • Sha

@Dan_Bown @shahin.fard

Yes the path must be absolute, since the underlying mechanism doesn’t assume that the image must be inside your Katalon project.

You can utilize Test Object Parameterization to pass the path to the current project inside the Test Object.


TestObject to = findTestObject('test', ['screenshot' : RunConfiguration.getProjectDir() ])



2020-04-15 11:35:38.608 DEBUG testcase.New Test Case                   - 2: println(getValue().toString())
/Users/thanhto/Katalon Studio/Test projects/MyProject/image/yourimage.jpg
Test Cases/New Test Case

The screenshot property will then be used by the image recognition algorithm to retrieve the image.

Please try and let me know if it works, or if your use case demands something more.


Hi all.

We incorporated this to a new Self-healing feature in 7.6.

Specifically relevant to this thread, now you can specify relative path of the image.