How to perform the same action repeatedly when the only thing that changes is the search image

I have a process that goes to a website, clicks a menu item, waits for it to appear and then clicks the browser's back button. I need to repeat this process multiple times selecting different menu items.

Create a scenario with a Find Image action which will use a variable in a CSV file. The values of that variable will be the existing image file names. Pairing this technique with a loop action will enable the scenario to perform the same process on multiple menu items.

Using this technique, the example scenario below will navigate through multiple categories of Books on the Amazon website.

1. In ScenarioBuilder, click the Home tab, and then click New.

2. Name the scenario: SearchingBooks.

3. Click Open web app.

5. In the URL field, enter "www.amazon.com" and then click OK.

6. Perform the following actions on the Amazon web site. Open the All drop-down, click Books, and then press ENTER.

7. Stop the recording.

8. Add a Loop action. Note: The iterations properties will depend on how many images you will create. 

14. With the Loop step selected, click the ellipse button for the Variable File Name property.

15. Enter "BooksImage" in the Name field.

15. Enter "BookName" in the A column and then enter names for your images below BookName. They must contain the .bmp. For example:

How to create a scenario that will allow the same actions to be performed to multiple items by using the image names as a variable within the Images actions_ (221401627)_Screenshot_27

16. Once you are done, click OK. The properties window should look like this:

How to create a scenario that will allow the same actions to be performed to multiple items by using the image names as a variable within the Images actions_ (221401627)_Screenshot_28

17. Go to Home tab and click Capture Additional Images to initialize capturing images that will be used as variables. For this scenario, capture images for the following menu items.

  • Award winners - named 1.bmp
  • Top 20 lists in Books - named 2.bmp
  • Deals in Books - named 3.bmp

18. Add a Find Image action and put it as a child action for the Loop.

19. In the properties, right click Find Image #1, and then click Choose a variable from the menu as shown below.

How to create a scenario that will allow the same actions to be performed to multiple items by using the image names as a variable within the Images actions_ (221401627)_Screenshot_31

20. The "Select Variable" window opens. Type "BookName" in the Variable Name field, and then click OK.

21. Add a Mouse Move and Click action as a child of the Find Image step.

22. Add a Wait action that waits 5 seconds.

23. Add a Click on Image action that clicks on the browsers back icon.

Image Variable Script

Before sending your scenario to a controller or manager, you need to save the captured images as resources for the script. Follow these steps to complete that process.

  1. Click the View tab.
  2. Click Scenario Resources.
  3. Click the Images tab.
  4. Click Add var images.
  5. Select the variable images that were captured.
  6. Click Add.