Question
2
Replies
685
Views
Bank of America
Posted: January 4, 2017
Last activity: January 13, 2017
Closed
Solved
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.
Any suggestion please..
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.