TestObject using Xpath , Detect if that object is in page or not

Hi there,

I use following code to get dynamic objects

TestObject flexibleTestObject = new TestObject();

flexibleTestObject.addProperty("xpath", ConditionType.EQUALS, xpath);

But problem is sometime i want to see if flexibleTestObject is able to hold that html object or not.

What i want to do is, get a dynamic TestObect, if its in html and found do this, if not then try to find other dynamic object.

Currently what happens is that i get error that unable to click "null". So i want to see when a TestObject has a value of null or not.

Please advise

Thank you very much :slight_smile:

Please use Verify Element Present to check a test object is in html page or no. Beside that, using flowControl param as FailureHandling.OPTIONAL to keep the execution continue working if the verification is failed.

Sample code:

while (!WebUI.verifyElementPresent(flexibleObject, 30, FailureHandling.OPTIONAL)) {

//change flexibleObject's xpath here