Micro Focus QTP (UFT) Forums
How to check two different webelement values - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to check two different webelement values (/Thread-How-to-check-two-different-webelement-values)



How to check two different webelement values - automation2012 - 08-28-2012

I need to verify the shipping value and total value after adding the items into basket. Both the objects are weblements.. i have added one object in repository and written the statement to retrieve the weblement value using getroproperty and in the OR i have used regular expression for innertext property..when i try to add other webelement its identifying the same first already added weblement..i need to verify the both the values...there is no table..only browser(...).page(..).webelement....please help me in this regard how to retrieve both the values...is there any possible solution for this..


This was the case where for both its considering the same weblement even if the both values are at different place in the application

Code:
aShipQty = Browser("...").Page("...").WebElement("Quantity").GetROProperty("innertext")
PRINT aShipQty
aTotal = Browser("...").Page("...").WebElement("Quantity").GetROProperty("innertext")
PRINT aTotal



RE: How to check two different webelement values - ssvali - 08-29-2012

Please post the screen shot along with properties...


RE: How to check two different webelement values - QTPScript - 08-30-2012

Hello

Yes screenshot required. I will try to help with this.

First You can add web element in into OR. Now you can see how you can retrieve from class. I can see you are able to print the both thing. If you having problem while comparing add CStr(YOUR VARIABLE NAME) now you can compare easily using any if condition.

one more thing if you still not able to retrieve data from web element.
1) open OR(Object Repository) and see class and follow that to get the data.
2) You can retrieve from "text" too. innertext is also fine. You can try if having problem with inner text.

Suggestion:

To get accurate help. Always try to explain in descriptive manner and use snapshot and other things to make sure other user of forum can understand perfectly. You can include what ever you are getting and all things. User like me will run code on my QTP and find right solution.

Best luck.


RE: How to check two different webelement values - basanth27 - 09-01-2012

Why did you regular expression'd the weblement? Why dont you add each one differently?
Check out the object spy and see which property is unique. You should be able to use that.