Posted: 4 Jan 2017 12:27 EST Last activity: 13 Jan 2017 11:07 EST
How to detect if control not matched.
I have matched a control in webapplication and lets say it's a button. And in automation the button will perform click. In certain senario the button may not be visible and automation tries to perform click and exception displayed that "The control <<controlName>> is not matched".
Is it possible to check in automation before executing perform click. In my case automation should end when button not exist.
There are several ways to do this. First, you should use WaitForCreate to wait for controls to be created. Creation is not when you see the control on the screen, but when the automation engine has attached to the control. This will happen at some point after you see the control. The WaitForCreate can be supplied with a timeout, but will only wait as long as necessary.
Additionally, each control has an IsCreated property which can be checked prior to using the control.