Custom keyword fail using Web service (default) execution

public class scrnshot{

@Keyword
def takeWebElementScreenshot(response) {

	WebUI.openBrowser (response)
	WebUI.delay(3)
	WebUI.takeScreenshot()
	WebUI.delay(3)
	WebUI.closeBrowser()
}

}

I use the script above for my custom keyword and I assigned it in my test case. The response indicated the input in test case which is the url link. when I run my test case using web service, the custom keyword are failed however, it is working when I execute using chrome(headless).
therefore, I would really like to know what is wrong with the script I write as I’m quite new in using Groovy.

This is a web UI test and you should not run it using “Web Service” mode.

so does that mean Web Service execution can be done if it only consist of web service keywords in the test case? is there any possibility to enable webUI keywords in web service execution? but thank you for the reply, that really help clearing things out for me.

Hi @baitirahim

You can create a Generic project and you’ll be able to use both WebUI and Mobile as well as Web Service keywords in your project.

Cheers !

may I know what is generic project? is the basic project in Katalon?

It’s a type of project in Katalon Studio, when you create new project it will ask you which type of project you want to create, choose your specific type of project.

ohhh I see. thanks for your help!!!