WinActor

2020.12.24
SampleScenarios
Save screen capture with file name of current date and time.

As a method of saving with a unique file name, it is a sample scenario to save the screen capture with a file name including the current date and time, taking as an example where an exception occurs.
*Please see this precautions upon downloading this sample scenario.

Feature

The purpose of this sample scenario is to take a screen capture as a log when an error is detected during processing and save it with a unique file name. The outline of the process is as follows.

  • Start the browser and move to the specified web page.
  • Click the link on the web page to move to the next page, but a page that does not exist (an error page) is displayed.
  • You click the link on the error page, but an error occurs because the target does not exist, and the abnormal processing of the exception handling group is executed.
  • The following is executed in the abnormal processing of the exception handling group.
    • Stores values including the file title, current year, month, day, hour, minute, second, and extension in the variable of the file name.
    • Concatenate the folder path and file name and store them in the variable of the output destination file path.
    • Saves the full screen captured file displayed on the desktop to the specified file path.

WinActor(OR-5200) Modules to use

In this sample scenario, the following WinActor(OR-5200) modules are used.

  • FileName_MakePathName.ums6
  • ScreenCapture_SaveDesktopImage.ums6
  • Browser_Browse.ums6
  • Browser_Launch.ums6
  • Browser_Click.ums6
  • PL1912_442_GetDate_yyyymmddhhmmss_script.ums6

Operating Environment

The operation of this sample scenario works in the following environment.

  • Windows 10
  • WinActor 6.1.0
  • Google Chrome 78.0.3904.108

How to use

The usage of this sample scenario is as follows.

Step 1. Load the sample scenario

Extract the downloaded ZIP file and load this sample scenario included in the extracted folder with WinActor.

Step 2. Set variables required for operation

Set the values required to execute this sample scenario in the variable list. The following two variables need to be set in advance.

variableList.png

Variables that need to be set in advance

  • Test page
    • Specify the attached sample (test1.html) with an absolute path.

Example) C: \ winactor \ test1.html

  • Output folder
    • Specify the absolute path to the folder where you want to save the screen capture.

Example) C: \ winactor \ output

In this sample scenario, there are variables to change the behavior. There is no problem if you execute with the default values, but if you want to change the screen capture file name output when an error occurs, change the values of the following variables.

  • Prefix
    • Specify the prefix of the screen capture file name.

Example) Error occurrence screen_

  • Suffix
    • Specify the suffix of the screen capture file name.

Example) .png

Step 3. Execute the sample scenario

Start executing this sample scenario with WinActor. The link click fails on the error page, the desktop screen capture is saved, and this sample scenario ends.

Step 4. Confirmation after execution of sample scenario

Make sure that the desktop screen capture is saved in the folder specified in the destination folder. Also, make sure that the screen capture has a file name that includes "year, month, day, hour, minute, second".

Trouble shooting

In this sample scenario, an error message will be displayed if a variable is specified incorrectly.

See the error message list for more information.

Explanation

This section describes the implementation techniques used in this sample scenario.

Save with a unique file name

"PL1912_442_GetDate_yyyymmddhhmmss_script.ums6" can store the current year / month / day / hour / minute / second in a variable. In this sample scenario, the screen capture is saved with the file name of the error occurrence time.

normalOperation.png

Screen capture output subroutine

By specifying "Error occurrence screen_" as the prefix of this library and ".png" as the suffix, it is stored in a variable as the file name including the file title and extension.

getDateLibrary.png

Property settings of PL1912_442_GetDate_yyyymmddhhmmss_script.ums6

As mentioned above, by specifying "Error occurrence screen_" as the prefix of the library and ".png" as the suffix, the file name including the file title and extension is saved as a unique file name.

Also, if you do not specify the prefix and suffix in "Get year / month / day / hour / minute / second (yyyymmddhhmmss)", only the year / month / day / hour / minute / second can be stored in the variable, so you can create a unique folder name.

Save trail when an error occurs

By using the exception handling and subroutines of this sample scenario for a scenario used in your work, it is possible to save trail in the event of an error. For example, you can take a screen capture during operation when image matching fails or an error occurs in Excel operation. Trails such as screen captures can be used for investigating the cause of errors and sharing execution results.

Scenario change for normal operation check

This sample scenario can be executed without any error for checking the operation. By changing the file name of the attached "test2_dummy.html" to "test2.html", the operation will be as follows.

  • Display "test1.html" and click "Next Page".
  • "test2.html" is displayed, and click "Next Page".
  • "test3.html" is displayed, and this sample scenario ends normally.

normalOperation.png

Nodes executed during normal operation

Track changes

VersionDateDetails
1.0 10/27/2020 First edition