get modal definition
Name | Description | Type | Modifier |
---|---|---|---|
variable | (Optional) Variable to receive the returned value. | String | None |
Scenario: You are aware of the fact that the AUT under development is, at times, capable of throwing unexpected exceptions, resulting in the appearance of modal dialogs. You wish to allow your test to handle such exceptions gracefully wherever they may occur, by dismissing the dialog, so that automation may continue. You also want to record the error message displayed by the dialog. Hence, you want the action lines handling this contingency to:
- Capture screenshots when the modal dialog box unexpectedly appears, using the built-in capture screen action.
- Click the Continue button, which such exception dialogs are always expected to have, to dismiss the dialog and allow automation to proceed.
- Allow for the possibility that a modal dialog other than the standard "Unhandled exception" dialog has appeared, one that lacks a Continue button. Hence, if your procedure is unable to find a Continue button, simply attempt to close the modal dialog box with a built-in close window action.
image location
capture screen D:\images\exception.bmp
 
variable
get modal definition modal
 
window control
if control exists #modal [ta class=button, text=continue]
 
window control
click #modal [ta class=button, text=continue]
 
else
 
window
close window #modal
 
end if
action
on modal action modal dialog handler
 
config
 
start application
At line #19 in the test procedure during the automated run, an unexpected modal dialog box appears. This triggers the modal dialog handler action to dismiss the dialog. Subsequently, TestArchitect resumes normal automation starting with the last action (line #19) executed prior to the invoking of the handler action.
- variable argument:
- The returned variable contains values of the following TA properties: title, parent title, and handle of the modal dialog box.
- If the variable in argument variable has not been declared, the action creates it as a global.
- If the variable argument is left empty, TestArchitect supplies a global variable with the name _result.
- Use the get modal definition built-in action in combination with the on modal action built-in action to handle the unexpected modal dialog box properly.
- This action supports the <ignore> modifier. If the string
<ignore>
is present as the value of the argument, or the argument contains an expression that evaluates to<ignore>
, the action is skipped during execution.