No such property: ConditionType for class eror when creating custom object

Hello,

Due to the way my application works, some items on screen load before others. Some of the attributes of these slow loading elements change depending on wether they have loaded or not. I want to create a custom method which will check the status of these elements and delay execution until they are ready to be interacted with. I have tried wait until element is visible/present and they do not work.

For some reason, my code is not working though, any ideas? I really am not sure what I am doing wrong

@Keyword
def waitForAttributeToLoad(String webObjectXpath, String attributeToCheck, String expectedLoadingCompleteText)
{
//create a new webObject
TestObject objectToCheck = new TestObject()
//Give the webObjects a path locator (This is where it is failing)
objectToCheck.addProperty("xpath", ConditionType.EQUALS, webObjectXpath)
//Check that the webobject has the completed loading attribute, if not, delay execution for 2 seconds
while((WebUI.verifyElementAttributeValue(objectToCheck, attributeToCheck, expectedLoadingCompleteText, 1)) == false)
{
WebUI.delay(2)
}
}
webObjectXpath needs to be a valid xpath, in quotes. Something likeobjectToCheck.addProperty("xpath", ConditionType.EQUALS, "//div[@id='webObjectXpath']")

Mate Mrse said:

webObjectXpath needs to be a valid xpath, in quotes. Something likeobjectToCheck.addProperty("xpath", ConditionType.EQUALS, "//div[@id='webObjectXpath']")

  

But I am passing the xpath through as a string (webObjectXpath) when I call the method?

Oh, I see.

Do you get any error messages?

The exact error message is :

07-09-2018 02:12:23 PM - [ERROR]  - No such property: ConditionType for class: customMethods.WaitForAttributeToLoad

Possibly you need a line:

 import com.kms.katalon.core.testobject.ConditionType
4 Likes

Justin Harper said:

The exact error message is :

07-09-2018 02:12:23 PM - [ERROR]  - No such property: ConditionType for class: customMethods.WaitForAttributeToLoad

Thats the badger, thank you! I’ll post a better version of my function shortly

Thanks, man. This was a solution.

Thanks…i had the same prob, i just added the line in my script …and it works