Forum Discussion

atulghumade's avatar
atulghumade
New Contributor
6 years ago
Solved

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();

     

  • AlexKaras's avatar
    AlexKaras
    6 years ago

    atulghumade wrote:
    AlexKaras I'm using Python script. I googled and tried to find evaluate() function in Python but it didn't help. What is evaluate() in Python Script?

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

    https://www.programiz.com/python-programming/methods/built-in/eval was the first topic returned by this query: https://www.google.com/search?q=python+eval

    ;)