Forum Discussion

atulghumade's avatar
atulghumade
New Contributor
6 years ago

Use Image from Image repository using for Loop

Hello Team, Scenario: "ImageRepository" has few images:       ImageSet:                      Image_1                      Image_2                      Image_3                      .  ...
  • AlexKaras's avatar
    6 years ago

    Hi,

     

    You need to use eval() or evaluate() function, depending on the scripting language of your test project.

    Algorithm:

    -- create a string that represents full name of the image/object;

    -- execute eval() to resolve the string to the object;

    -- call required method of the object.

     

    Sample pseudocode:

    var index = 1;

    var strObjName = aqString.Format('ImageRepository.ImageSet.Image_%i', index);

    var oObj = evaluate(strObjName);

    oObj.ClickM();