get modal definition

Retrieve the definition of the current modal dialog box.
NameDescriptionTypeModifier
variable

(Optional) Variable to receive the returned value.

StringNone
The definition of the current modal dialog box.
This action may be used within the following project items: test modules and user-defined actions.

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:

  1. Capture screenshots when the modal dialog box unexpectedly appears, using the built-in capture screen action.
  2. Click the Continue button, which such exception dialogs are always expected to have, to dismiss the dialog and allow automation to proceed.
  3. 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	
&nbsp		
	variable	
get modal definition	modal	
&nbsp		
	window	control
if control exists	#modal	[ta class=button, text=continue]
&nbsp		
	window	control
click	#modal	[ta class=button, text=continue]
&nbsp		
else		
&nbsp		
	window	
close window	#modal	
&nbsp		
end if		
        
    
        
        	action
on modal action	modal dialog handler
&nbsp	
config	
&nbsp	
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.

Copyright © 2023 LogiGear Corporation. All rights reserved. LogiGear is a registered trademark, and Action Based Testing and TestArchitect are trademarks of LogiGear Corporation. All other trademarks contained herein are the property of their respective owners.

LogiGear Corporation

1730 S. Amphlett Blvd. Suite 200, San Mateo, CA 94402

Tel: +1(800) 322-0333