So i am using dynamic object and i can receive an API that list all of the object’s properties such as ID in one page, but that ID is the ID of a frame layout which is not interactable and only contains child such as textbox or error message.
what i’m trying to achieve is to know the properties of that parent object so that i can try to interact with the child,for example the textbox EditText inside. I am able to interact with the child by using the xpath but havent found a way to determine the parent by the determined ID.
I am trying to make an automatic testing that only uses the API as a reference point to check what are the object to test so that in the future i dont have to change the test script in case of any changes in the configuration.
i can check the API for existing object properties like this:
public static checkIfExistForm1(String code){
def response = WS.sendRequest(findTestObject("Object Repository/WebService"))
def json = new JsonSlurper().parseText(response.getResponseBodyContent())
for(int i = 0;i < json.page.form.fieldset.size(); i++){
if(code.contentEquals(json.page.form.fieldset[i].control[0].id)){
return true;
break
}
}
return false;
}
and then i can make some kind of method to get the child of that object, and try to interact with it
for example with this method i can select an object by xpath
public static getObjectID(String code){
//considering i know that this is the child, or creating another validation
//the child(EditText) also has ID "content-desc" that i can use
String dynamicIdPath = '//*[@content-desc="%s"]'
String xpath = String.format(dynamicIdPath,code)
TestObject to = new TestObject()
to.addProperty("xpath", ConditionType.EQUALS, xpath)
return to
}
any thoughts ? thanks!
