cancel
Showing results for 
Search instead for 
Did you mean: 

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

Highlighted
Frequent Contributor

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 7
Community Leader

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

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. .  


-------------------------------------------------
Standard syntax disclaimers apply
Regards,
Community Leader

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

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).

Occasional Contributor

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

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

Regards,
Sathish Kumar K
Community Manager

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

Hi @kaiiii,

 

Was the issue solved? Please share the solution with us or let us know if you need any more assistance.

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Frequent Contributor

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

No.. not solved yet.

still looking for an answer.

Community Leader

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

@kaiiii 

Hi Can you try check my last example from this topic?

 

https://community.smartbear.com/t5/TestComplete-Functional-Web/How-to-handle-dynamic-object-IDs-usin...

 

Try to translate this JS into your VB script.

Community Hero

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

Hi,

 

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

Knowing nothing about your tested application, this is what I would try:

-- Set a breakpoint on the line next to the .Find() call, Evaluate found q_textbox object and note the value of its q_textbox.FullName property;

-- Set another breakpoint on the line where you expect to see value of .Text to be equal to 4 and continue execution;

-- When execution stops at the second breakpoint:

  -- Highlight UI element that you expect to correspond to the q_textbox object using Object Spy and check: a) if the value of the .Text property equals to 4; and b) if the value of the .FullName property equals to the previously noted one.

If values for FullName do not match, this obviously means that you work with different objects and must search for this another object before using it in test code.

If values for FullName do match, this may mean that the object was recreated somewhere between two breakpoints. Again, in this case you need to search for the same (but recreated) object before validating its value.

 

Generally speaking, the following workflow should be used when working with dynamic web pages: if the value of some UI object's property in test code does not correspond to your expectation but Object Spy displays correct value for the highlighted UI element, this usually means that the given UI element was recreated and must be searched for anew.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
New Here?
Join us and watch the welcome video:
Top Kudoed Authors