We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More

Forum Discussion

Azeddin_Margani's avatar
Azeddin_Margani
Frequent Contributor
4 years ago
Solved

Passing of ImageRepository name or item from excel

 Hi all, 

Could someone please tell me how to pass ImageRepository name and or item from excel sheet. 

e.g.

ImageRepository.name.item

or

passing both name and item for use in JavaScript. 

 

Many Thanks.

AM.

 

 

 

  • AlexKaras's avatar
    AlexKaras
    4 years ago

    Hi,

     

    Try something like this:

    var strItemFullName = 'Imagerepository.imageset.item';

    var Button = eval(strItemFullName);
    Button.Click;

     

    Does this help?

     

  • Hi AlexKaras, 

     

    The use of eval() proven to be working before converting the passed parameter to a string. 

     

    Many Thanks,

     

5 Replies

  • Marsha_R's avatar
    Marsha_R
    Icon for Champion Level 3 rankChampion Level 3

    Here's how you read data from an Excel file

    https://support.smartbear.com/testcomplete/docs/testing-with/working-with-external-data-sources/excel/read.html

     

    The repository name won't be any different than any other piece of data.  You can either grab it directly from Excel in the script or you can read it into a variable from Excel and have your script access the variable.

    • Azeddin_Margani's avatar
      Azeddin_Margani
      Frequent Contributor
      Hi Marsha,

      Please note i'm referring to the imageset.item of an image name that has already been saved in the image repository as (PaymentButton.Payment) where:
      Imageset is: PaymentButton
      Item is: Payment.

      The piece of code to execute is.

      Var Button =Imagerepository.imageset.item;
      Button.Click;

      I need to parametrize imageset and item so that it can be used on any image saved in the imagerepository. I tried to pass both imageset and item from excel but it doesn't seem to work.

      Please provide me with an example on how this can be done.

      Thanks.
      AM.
      • AlexKaras's avatar
        AlexKaras
        Community Hero

        Hi,

         

        Try something like this:

        var strItemFullName = 'Imagerepository.imageset.item';

        var Button = eval(strItemFullName);
        Button.Click;

         

        Does this help?

         

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    Would the sections and examples in https://support.smartbear.com/testcomplete/docs/reference/project-objects/items/image-repository/index.html, help you?

     

    Example