Micro Focus QTP (UFT) Forums
How to distinguish objects via other properties than shown via Object Spy? - 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 distinguish objects via other properties than shown via Object Spy? (/Thread-How-to-distinguish-objects-via-other-properties-than-shown-via-Object-Spy)



How to distinguish objects via other properties than shown via Object Spy? - MGMN - 09-16-2008

I'm recording QTP scripts in a web application that is mainly built in javascript. When clicking on a menu (dropdown style) there are eight choices in the menu, but only some of them are active (clickable) and this is based on which brand you have chosen in an earlier page of the application.

When spying at one of the choices/objects in the dropdown menu (via ObjectSpy) both when the object is clickable and not clickable there are no differences in the QTP Test Object properties and the QTP Run-Time Object properties. Therefore I'm not sure how to make my QTP script know if the menu object is clickable or not.

How can I distinguish objects except for via the object property values that are shown in Object Spy?

When looking at the webpage source code of the menu object there are differences in the values for "isPermitted" and "class" (see code below), but is there a way to pick-up this difference into my QTP script?

Object when inactive and not clickable:
Code:
<div style="pixelWidth:300" value="10:02" id="31" title="Drop-down Choice 1" isPermitted="false" typeId="1         " path="null" class='menuItemDisabled'  onclick="ShowMenu(SelectorContainer4);Do('31')" /><noBr>Drop-down Choice 1</noBr></div>


Object when active and clickable:
Code:
<div style="pixelWidth:300" value="10:02" id="31" title="Drop-down Choice 1" isPermitted="true" typeId="1         " path="null" class='menuItem'  onclick="ShowMenu(SelectorContainer4);Do('31')" /><noBr>Drop-down Choice 1</noBr></div>


(Edit changes: It should be a difference between the values for "isPermitted" in the code above and not "onclick" as I first wrote)


RE: How to distinguish objects via other properties than shown via Object Spy? - kishoreinchennai - 09-17-2008

Check the "disabled" property


RE: How to distinguish objects via other properties than shown via Object Spy? - MGMN - 09-17-2008

Thanks for the answer! The "disabled" property is not included in the object's Test Object properties (only in Run-time Object Properties) so I don't know how to check/pick it? It's not possible to pick it the same way as the Test Object Properties, when I try to get the value by using ddlink.GetROProperty("disabled"), no value is picked.

I don't know if it matters, but in my first post I forgot to mention that the choices/objects in the menu are WebElement class objects.


RE: How to distinguish objects via other properties than shown via Object Spy? - kishoreinchennai - 09-18-2008

Yes it matters..web element doesnt have a disabled property.

the only work around i could think is :

1)Click on menu something must happen if yes clickable nothing happenes not clikable

Since i dont your application i am not sure whether goingback after clicking is possible.

If you come across a better solution please let us know

regards


RE: How to distinguish objects via other properties than shown via Object Spy? - MGMN - 09-18-2008

Thanks again, kishore!

I will start working on the work-around you suggested, but if someone else know a way to see if a WebElement object is active/clickable or not, I would appreciate the information.


RE: How to distinguish objects via other properties than shown via Object Spy? - roxer - 09-18-2008

Hi, MGMN
Can you attach screenshot of ObjectSpy window with properties and screenshot of this menu. I want to know how it looks like, maybe I will have solution for your problem