The Image Doctor wizard was delivered in v3.5. It allows to resolve image comparison failures in executed scripts, especially in cases where the system has changed and the image comparison code and/or the template images must be updated. The wizard consists of three elements:
- The Image Doctor Warning pop up window allows to resolve image comparison interactively.
- The Image Doctor Records facility records failed image comparisons in the automation (unattended) mode for later resolution.
- The ImageDoctor command (for TPR scripts) and the corresponding imageDoctorXXX() methods (Java scripts) control the Image Doctor behaviour from a script.
Behavior of the Image Doctor is subject to the Robot's start up mode and options selected in the Edit -> Preferences -> Image Doctor configuration screen:
- Image Doctor gets activated on start up when the "Start Image Doctor on Robot start up" option is on. The factory setting is "on".
- If Robot was started in the development mode (without the r/-run CLI option) and a command or a Java method call employing image comparison fails in the currently executed script, the Image Doctor Warning window pops up.
- If Robot was started in the automation mode (with the r/-run CLI option) and a command or a Java method call employing image comparison fails in the currently executed script, the wizard records the failure through the Image Doctor Records facility.
- To make the wizard pop up the Image Doctor Warning window in the GUI automation mode select the corresponding option in Preferences or set on the Script -> Enable Image Doctor Warning menu item. The item is visible only in the GUI automation mode.
2. Image Doctor Warning
The Image Doctor Warning window allows to resolve comparison failures immediately without having to stop the currently executing script.
- The "Resolve Now" button opens up the command editor (the command "Properties" window). Update the comparison parameters and/or the template images as needed (limitations apply) and save the changes with OK. You may optionally apply other changes directly in the script editor and/or the Project View while the script is paused. Then resume the script by clicking the Resume button and the comparison command will re-execute. This will allow the script to continue as if the failure had never happened.
- The "Record & Resume" button will store the data of the failure to the hard drive and resume the script. The record may be then viewed in and eventually resolved through the Image Doctor Records window.
- The "Ignore & Resume" button will resume the script without any further action.
You may modify the command parameters and/or recreate, add or remove the template images. You may also modify the code after the command. No changes in the preceding code (the already executed one) will be picked up unless they are in an already existing procedure.
You will be allowed then to modify the method call parameters and/or recreate, add or remove the image templates under the following rules:
- Images can be modified only if they are referred to by the name and/or path directly (no parametrized or composed file/path names).
- The script must execute from the source code (.java). Scripts started through the main() method from a compiled .class file do not support the Resolve Now operation.
- Any changes that do not modify the Java source code will work without any limitations. This applies for example to recreation (rewriting) of images, adding of new images to already referred collections or modifying the command preferences.
- Any other parameter changes will apply just to the particular comparison. If this method call gets called again within the same execution you will have to reapply them because the compiled Java code can't be reloaded until the script finishes. The next time you start the script the changes will be applied permanently.
3. Image Doctor Records
The Image Doctor Records facility captures data about failed image comparisons for later use. This approach is used mainly when the script is executed through the r/-run CLI option in a production environment. It works as follows:
- An image comparison fails in a script started through the r/-run CLI option.
- The facility detects the failure and records a PNG screen shot and a .properties text file with the details (failure cause and location, date, environment). The data is stored to the imgdoctor/ folder under the home of the project the script belongs to. If there's no project the data goes to <userHome>/imgdoctor.
- The facility saves an entry of the new record to the user configuration file. This mechanism ensures that the new incidents are reported later after Robot gets started in the development mode.
- The script resumes as expected.
The records may be also created manually through the Record & Resume button of the Image Doctor Warning window. The next time the user starts T-Plan Robot Enterprise in the development mode (without r/run), the GUI reports that there are new records and suggests to resolve them through the Image Doctor Records window. The window is also available through the Script>Image Doctor Records menu item.
- The New Records tree branch displays new incidents which haven't been reported yet. This list is loaded from the configuration file and it may comprise of records created across multiple projects. The Current Project Records tree branch lists all records available in the current project.
- The tabbed pane at the bottom displays details of the currently selected record.
- The Resolve button allows to resolve the failure in three steps:
a) The script is opened in the script editor and it changes the position to the failure location. The GUI also reopens the script project if it is different from the current one.
b) The PNG screen shot is loaded either to the desktop view through the Static Image connection or to the command Properties dialog only. The latter option will preserve the current desktop connection.
c) The command Properties window gets displayed to allow adjusting of the command against the recorded screenshot image.
- The Show Location button will show location of the selected record in the script editor. This action will not reload the script project if it differs from the current one.
- The Open Project button will reopen the project the selected record belongs to. The tree of records will be updated accordingly.
- The Delete button will delete the selected record(s).
- The Configure button leads to the Image Doctor screen of the Preferences window. It controls the facility behaviour.