Forum Discussion

kaiiii's avatar
kaiiii
Regular Contributor
5 years ago

How to re-check a property value of an object.

I have declare an object, which have "Text" property with value 1.

Below is the object please check

Set q_textbox = page.NativeWebObject.Find("idStr","updatedQty_0")

 

after further execution of my script this object value is changed in application as 4 and then i am trying to print the value in test log but it still displaying value 1 in logs.

How can make a re-check condition for this object so it will print new value in the log ?

7 Replies

  • Is your item in, say an update panel - in other words loaded by means of ajax/callback or the like ?  TC may not be able to pick up on the change to the object's properties in this case.  You may need to use RefreshMapping on the page object or refetch the object if this is the case.  Out of interest, why don't you use NameMapping&Aliases ? Also, keep in mind, TC objects are not entirely Object Oriented model objects.  You don't neccesarily store a reference to an object, so if you go fetch a TC object with .Find, you aren't exactly working on that page "Object" directly.  So, the page may change, but your instance of it won't always be able to reflect the property changes unless you are explicitly doing checkproperty in which case TC is polling the page object to find out when it changes or refresh mappings etc. .  

    • Wamboo's avatar
      Wamboo
      Community Hero

      If you have access to this object in the application, why don't you do another .find search and find the same object?

      You can also use "OnLogEvent" event (this is not the most elegant solution).

      • Mr_Bro's avatar
        Mr_Bro
        Champion Level 0

        Hi kaiiii ,

         

        after finding the object for the first time, just do "Sys.Refresh()" and again try finding the object.

        i guess that vll work.

         

        Regards,

        Sathish Kumar K