Micro Focus QTP (UFT) Forums
Anyone know the difference of the 2 statements - 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: Anyone know the difference of the 2 statements (/Thread-Anyone-know-the-difference-of-the-2-statements)



Anyone know the difference of the 2 statements - martinlam - 08-26-2010

Please help on the difference of the 2 statements:
1. ...(item).Click
2. ...(item).Object.Click

Thank you in advance.


RE: Anyone know the difference of the 2 statements - basanth27 - 08-27-2010

Martin,
Have you executed both the statements ? Do you see any difference ?

One method is a direct click while the other was instantiate a object before clicking on it. Hope i am correct...in simple terms there is no difference in the click action.


RE: Anyone know the difference of the 2 statements - martinlam - 08-27-2010

Thank you very much for the reply.

Yes, I had executed both statements and get 2 different response.
1. It will get a run-time error when i play back the script and said "the object is disabled" but I had checked the object ("disabled") property with getroproperty method and returned it was NOT "disabled"
2. the error was fixed.

Therefore, i want to know the exactly the difference between them.


RE: Anyone know the difference of the 2 statements - QTPLearn - 08-31-2010

Hi
Basically it defines the Object Hirerachy i.e Document Object Model.


1) (item).Click : This will work incase if you are directly accessing the Parent Object(in your case it is 'item').

2)(item).object.click : This means the object which you are trying to access is not a direct object. I mean to say it has one container and on that it is exposed. so to acess that one you need to set to parent class and then search for the Object. This is applicable to Rendering type of object which develop through HTMl Tags or Ajax control.


To understand the difference you need to check 'View --> Source' in IE.

~regards