Hello friends,
right now I’m trying to create a TestObject during Runtime.
I have a TestObject (Button) in my Repository that is working fine.
And its settings look like following:
So “Selection Method” is “Attributes” and Katalon automatically set the Properties:
type equals “button”
text equals “Submit”
Now I’m trying to reproduce this by code. But my problem is that I can not find any helpful documentation. There are plenty examples of using SelectionMethod “CSS”, “XPATH” … but found nothing about what I want to do:
https://docs.katalon.com/katalon-studio/docs/web-selection-methods.html#change-the-css-selector-of-an-object-at-runtime
https://docs.katalon.com/katalon-studio/docs/handling_static_dynamic_test_objects.html#introduction
https://docs.katalon.com/katalon-studio/docs/manage-web-test-object.html#validate-a-test-object
I tried this:
TestObject makeTestObject(String buttonText) {
TestObject testObject = new TestObject()
testObject.setSelectorMethod(SelectorMethod.BASIC)
testObject.addProperty("type", ContitionType.EQUALS, "button")
testObject.addProperty("text", ContitionType.EQUALS, buttonText)
return testObject
}
Here I couldn’t find a SelectionMethod called “Attributes”.
There is only “BASIC”, “CSS”, “IMAGE” and "XPATH.
So what exactly is “BASIC” (as this is no option in GUI-mode) and what do I have to choose, when I want to reach my goal?
This is quite confusing.
Running this got an error:
Any help would be wonderful.
And before you ask why I don’t use the Xpath:
The Ids of the buttons in our WebApp changed way to often, and I don’t want to have to edit all the objects everytime this happens. So I realized Katalon always find’s a button when I just hand over the type and text, cause the text never changes (till now).
Thanks and have a nice day,
Simon