How to control time taken to check if an object Exist or no when using the method Exists
Hi,
I am using below code to check if dialog present in application is still available or no after clicking on OK button.
page2_5AxisEndConditions.Tick.Click();
if (page2_5AxisEndConditions.Exists)
{
dlgCAMWorksMessage.btnOK.Click()
Log.Error("Feature could not be inserted")
page2_5AxisEndConditions.Close()
}
This code works correctly.
However, if dialog (page2_5AxisEndConditions) does not close on clicking OK it waits for 10 sec, while executing the Exists method. I want it to wait only for 2 sec as this code is going to be used again and again and this will slow my script execution.
How to control this wait time through code only for this dialog? Or there is any other method to do this ?
Any help is appropriated.
Regards,
Rushikesh Kadam.
You can implement some checkObjectExists() method:
function checkObjectExists(object, timeout) { Options.Run.Timeout = timeout; if object.Exists { do_something(); } else { do_something_else(); } Options.Run.Timeout = 10000; }