Below is an example. How to call the plug-in keyword in my project’s custom keyword.
// Normal TC- find web element by angular
WebElement fn = CustomKeywords.'com.katalon.plugin.keyword.waitforangular.WaitForAngularKeywords.findWebElementBy'(ByAngular.model("person1.firstName"))
fn.sendKeys("Fred")
doesn’t’ matter. you can put whatever you like after as and use it accordingly later in your code.
but if i have to guess i will say mm stands for MyMethod
Here I noticed that findWebElementBy is underlined. The underline implies that Katalon Studio regards this piece of code invalid, and therefore this code would not work. Why is findWebElementBy underlined?
I think that the findWebElementBy method of com.katalon.plugin.keyword.waitforangular.WaitForAngularKeywords class should be declared as static. There would be no reason not to do so.
Here I feel confused: CustomKeyword’s syntax is too similar to calling a static method named findWebElementBy, but it is not necessarily a static method. Katalon’s CustomKeywordshides the difference between a static method and an instance method. Is it a good design or not? I am not sure.
But when a user tries to use the plugin class in a context of Keyword class == out of CustomKeywords in a Test Case, the difference matters. Should he/she call the method as an instance method or a class’s static method in a Keyword class? How he/she can find the answer? The only way for them is to read the javadoc and think deep.