Forum Discussion

kaiiii's avatar
kaiiii
Regular Contributor
6 years ago

How can we manage a value that is getting change after every journey.

I am trying to handle an object whose radioButton value is getting changed every time.

Please check below, where highlighted value is getting changed every time.


Set Cart1 = page.Panel(3).Panel(2).Panel(3).Panel(0).Panel(1).Panel(0).Panel(0).Panel(0).Panel(1).Form("updateCartForm0").Panel(1).Panel(0).Link(1).RadioButton("budgetpay_com_lc_facade_order_data_LCOrderEntryData_4ad0f830")

 

how can i make it dynamic so that this object can accept every unique value.

I tried by Using "*". but it did'nt work.

please help

  • Hi

     

    In JavaScript you can write an anonymous function in a variable and in it use the function .findxxx() which you will get the value.

     

    I don't know how it will be in VB but there is a way to do it.

     

    Just when you run the script TestComplete will not look for this object with the value "4ad0f830" but will find it dynamically.

     

    Use find with regular expression which means find all characters after "budgetpay_com_lc_facade_order_data_LCOrderEntryData_XXX".

     

    Doc:
    https://support.smartbear.com/testcomplete/docs/reference/misc/regular-expressions.html

    An example of a call with the find() method:

     

    Example for find function with regular expression:

     

    obj.FindAll(["Top", "Text"], [px, "regexp:^[0-9]+$"], 2);

  • Wamboo's avatar
    Wamboo
    Community Hero

    Hi

     

    In JavaScript you can write an anonymous function in a variable and in it use the function .findxxx() which you will get the value.

     

    I don't know how it will be in VB but there is a way to do it.

     

    Just when you run the script TestComplete will not look for this object with the value "4ad0f830" but will find it dynamically.

     

    Use find with regular expression which means find all characters after "budgetpay_com_lc_facade_order_data_LCOrderEntryData_XXX".

     

    Doc:
    https://support.smartbear.com/testcomplete/docs/reference/misc/regular-expressions.html

    An example of a call with the find() method:

     

    Example for find function with regular expression:

     

    obj.FindAll(["Top", "Text"], [px, "regexp:^[0-9]+$"], 2);

  • Mr_Bro's avatar
    Mr_Bro
    Frequent Contributor

    Hi Wamboo ,

     

    can you please try finding the parent object (ie. "Form("updateCartForm0").Panel(1).Panel(0).Link(1)") and after that try finding the childobject of that parent using findchild method by giving the identifier property as ("budgetpay_com_lc_facade_order_data_LCOrderEntryData_*")

     

    Kind Regards,

    Sathish Kumar K

    • Wamboo's avatar
      Wamboo
      Community Hero

      Hi K_Sathish_Kumar

       

      if the first part of the object identifier is fixed and only the next part (after the last _) changes, it should work:

       

      Aliases.Find("YourID", "regexp:(budgetpay_com_lc_facade_order_data_LCOrderEntryData_)", 5);

       

      This searches for the specified sequence of characters at the specified level by the parameter "5".

       

      So if I understand correctly, the first part of this indectifier is constant in the rest is variable. If so, and if there is only one such object, it should work.

      • Mr_Bro's avatar
        Mr_Bro
        Frequent Contributor

        is your problem fixed or not?

         

        Sathish Kumar K