How to create a scenario that uses image name to identify user credentials?
Follow

Challenge

How to create a Scenario that chooses which icon to click based on who the currently logged in user is?

Solution

Create a variable with “Variable Value” of [Env USERNAME];

In ScenarioBuilder, the “Env USERNAME” is the logged in user. Therefore, the “image_var” value in this example is the currently logged in user.Now, with the “Click on Image” action, capture an image of the icon you want your first user to click on. Name it (exactly) after the first user’s login name (e.g. WSmith).Add another “Click on Image” action, this time capturing an image of the icon you want your second user to click on. Name it after the second user’s loginname. Continue to do this for every user for which there is an icon to click.

Next, delete all of the “Click on Image” steps you just added to the Scenario, except for the first one. Your Scenario should look something like this;

Save your Scenario and exit ScenarioBuilder. Now, navigate to the folder containing Scenarios (default location is: //Documents/ScenarioBuilder/DefaultProject/scenarios/). Using a text editor (like Notepad) to open the .xml file for the Scenario you just created. Find the "Click on Image" step and replace the user specific name with the "image_var" variable that was set in the first step of the Scenario;

The .xml file should now look like below (note that the .bmp extension must be kept; also, be sure that the variable is framed with % signs);

Save and close the .xml file. Re-open your Scenario with ScenarioBuilder. It should now look like this;

Now, this step will always click on the image appropriate for the currently logged in user. It should be noted that this method can be applied to variables contained in CSV files.