Last updated 2020.12.24
SampleScenarios
Image matching while scrolling a web page.

This is a sample scenario to deal with the case where the image you want to match is in a position that cannot be seen without scrolling the screen. This sample scenario (hereinafter referred to as this sample scenario) that performs image matching while scrolling using a library that can scroll the screen of WinActor is explained.
*Please see this precautions upon downloading this sample scenario.

Feature

This sample scenario executes following process.

  • Select the screen scrolling method.
  • Start the browser and move to the specified web page.
  • Image matching is performed on the web page, and if the image matching succeeds, the scenario ends, and if it fails, "scroll the screen of the web page and image matching" is repeated the specified number of times.
  • If image matching is successful by repeating "scroll the screen of the web page and image matching", the scenario ends in the middle of the repetition. If the specified number of repetitions is exceeded, the message "No matching image" is displayed.
  • In the case of the attached sample (sample.html), when the "Send" button is pressed, the character string "★ Pressed ★" is displayed on the screen.

WinActor(OR-5200) Modules to use

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

  • 01_OR-5200_Control/02_ScenarioControl/StopScenario.ums6
  • 04_AutomaticRecording/Emulate.ums6
  • 12_Mouse/Mouse_OperateWheel.ums6
  • 01_OR-5200_Control/06_ScenarioInformation/GetScenarioFileName.ums6
  • 23_Browser/Browser_Browse.ums6
  • 23_Browser/Browser_Launch.ums6

Note

It may not work properly in an environment where the display resolution is high (resolution higher than Full-HD) or when the display magnification is adjusted.

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 the variables required for operation

In this sample scenario, there are variables to change the behavior.
When using the attached sample (sample.html) as an input file (substitute for a web page), there is no problem if you execute it with the default values, but if you want to change the target web page or the number of screen scrolls, change the values of the following variables.

URL
Specify the web page for image matching. * In the sample (sample.html), the initial value is blank, but it is created because the URL value is set from the value of the variable sample file in the "scenario folder file path" of the node. Consider deleting the "Scenario Folder File Path" node and the variable sample file according to the scenario to be created.

Example) https://winactor.biz/

Number of executions
Specify the number of times to perform "scroll the screen of the web page if image matching fails". * Since the screen is not scrolled the first time of image matching, if 10 is specified, image matching will be performed 10 times and the web page will be scrolled 9 times.

Example) 10

Step 3. Execute the sample scenario


Start executing this sample scenario with WinActor.
If the image matching is successful or the number of repetitions specified by the variable execution count is exceeded, a pop-up message will be displayed and this sample scenario will end.

Step 4. After completing the sample scenario


After the execution of this sample scenario is completed, the character string "★ Pressed ★" will be displayed on the web page specified in the sample file of Variables.

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.

Repeated image matching and screen scrolling

001.png

Branch that scrolls the screen from the second time onward in image matching

In order to prevent screen scrolling during the first image matching, Decision group of "Screen scrolling from the second time onward" is set up. As a result, if the value of the variable counter is 0, nothing is executed in this branch and the process moves to the next node.

002.png

If there is an error in image matching, move to Action exception

After that, if the left button of image matching is clicked and the image matching is not applicable, an error usually occurs and the scenario stops. However, in this case, since it is executing in the exception handling group, the processing moves to Action exception.

By counting up the value of the variable counter in Action exception, the screen scrolling branch processing is executed when the variable counter value is other than 0 in Decision group of "Screen scroll from the second time onward".

By setting the above process in the repetition group, screen scrolling and image matching can be repeated. In Pre-Test Loop group, it is repeated for the set number of executions.

Display of target web page


In this sample scenario, the sample (sample.html) is used as a substitute for the web page.

In the "Scenario folder file path" library, set the file path of the sample (sample.html) to the variable that stores the URL, and in the subsequent "Page display" library, display the web page by the URL in the variable.

Therefore, if you want to use a normal web page, delete the "Scenario folder file path" library and change the URL stored in the variable to the web page you want to process.

Also, change the property values such as the window identification name and action of the "Image Matching" node according to the screen to be scrolled.

Variations on screen scrolling method

ScrollSelection.png003-02.png


Selection of screen scrolling method and branching to the selected screen scrolling method

In this sample scenario, three types of screen scrolling methods are provided. The screen scrolling method selected in the "Selection box" node is set in the variable for the screen scrolling method, and the screen is scrolled by the selected method in the multi-branch group.

When creating an actual scenario, leave only a process of one of the screen scrolling methods. Since the application targeted for image matching in this sample is a web browser, it will work with any screen scrolling method.

When applying to an application other than a web browser, leave a screen scrolling method that enables screen operations of the target application.

Types of screen scrolling methods

  • Press PageDown button: Press PageDown button on the keyboard once in the emulation mode.
  • Mouse wheel rotation in direction toward you: Rotate the mouse wheel once toward you.
  • Press Down button: Press Down button (down arrow) on the keyboard once in the emulation mode.

Maximize window for excecuting “Mouse wheel rotation in direction toward you” library


Since “Mouse wheel rotation in direction toward you” library requires the mouse cursor to be moved on the window that scrolls the screen, maximizing the window size after the web page is displayed places the mouse cursor on the window.

Therefore, if you want to scroll the screen using a method other than “Mouse wheel rotation in direction toward you” library, "Maximize Window" node is not required.

Track changes

VersionDateDetails
1.0 10/27/2020 First edition