Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic Object or Virtual Object
#1
Not Solved
Hi,

I am farely new with QTP and self learning.

I have a situation and not sure how to deal with the Dynamic number of objects.

I have a Weblist Object. Depending on the item I SELECT from the Weblist Object a variable list of rows will be displayed on the screen which composes of the following.

WebCheck Box Object, Text Description and WebEdit Object.

Where:
Text Description represents Product Description and
WebEdit Object represents Quantity for the product.

The products can be selected by Clicking the Check Box and entering it's corresponding Quantity in the Edit Box. After the final selection and inputing the required values a Confirmation button is clicked which would display the final list of selected products with their quantity.

Not sure how to standardize this dynamic selection. Not sure if Virtual Object can be used since the the requirement is beyond Clicks and DblClicks as Values are required to be entered for the selected items.

Please help with your suggestions.

Thanks,
Subha
Reply
#2
Not Solved
Subha -
I think you need to read the object properties and then find the common values of the property, regular expression it and then use a combination of descriptive programming if necessary and then perform your operation. Virtual objects are out of context in the above case as you seem to mention that the objects are being identified by QTP.

Makes sense?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#3
Not Solved
Just to make sure, I am sending the scripts fron the Expert View based on 2 Items selected from a list of 8. This list can vary. The recorded objects are the Check Box clicked and it's corresponding value entered in the Webedit object. I am also attaching the properties for both the set of check boxes and their Webedit object having their values captured.

Please advise me how do I programatically Check to select and assign Value dynamycally? Do I use the Identifier value within each object property to identify and select?

Thanks,
Subha

DETAILS As Below:
Code:
Browser("wwe - WebWriter Enterprise").Page("wwe - WebWriter Enterprise_2").WebCheckBox("WebCheckBox_2").Set "ON"
Browser("wwe - WebWriter Enterprise").Page("wwe - WebWriter Enterprise_2").WebEdit("WebEdit_4").Click
Browser("wwe - WebWriter Enterprise").Page("wwe - WebWriter Enterprise_2").WebEdit("WebEdit_4").Set "80"
Browser("wwe - WebWriter Enterprise").Page("wwe - WebWriter Enterprise_2").WebCheckBox("WebCheckBox_3").Set "ON"
Browser("wwe - WebWriter Enterprise").Page("wwe - WebWriter Enterprise_2").WebEdit("WebEdit_5").Click
Browser("wwe - WebWriter Enterprise").Page("wwe - WebWriter Enterprise_2").WebEdit("WebEdit_5").Set "20"


Attached Files
.doc   Dynamic Object.doc (Size: 75 KB / Downloads: 91)
Reply
#4
Not Solved
Intresting. Well, its not on a webtable but on a page. The objects have been identified by their index.

Well here is what i was trying to explain,

1. It is clear from you explanation that when a checkbox is selected the edit is enabled and then you will need to put in the value. The issue is the variations and the checkbox and edit being displayed at varying numbers.

2. I would suggest that you spy on the webcheckbox and the webedit and find out which is the common property among the various appearing ones. Then you could do a raw descriptive program as such,
Code:
Eg:
Browser("wwe - WebWriter Enterprise").Page("wwe - WebWriter Enterprise_2").WebCheckBox("name:=driverlicense*","html tag:=Input").Set "ON"

Honestly, i am not very sure about the whole solution which i am offering. Although you have taken great pain to write up so much of a detailed explanation i feel ashamed to not have been able to decipher and imagine the application and suggest you a right forward solution.

Please attempt and let me know if you have been able to proceed any further.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#5
Not Solved
Thanks Basanth. I will try as you have suggested. In the meantime I have encountered the following error while I was exploring the ChildObject path. The corresponding code is also below where the error is occurring. Could please point my mistake.

Thanks,
Subha

Code:
Start Of Child Test
Set obj=Description.Create
'obj("html tag").value="TABLE"
obj("micclass").value="WebTable"
[b]td_obj=Browser("wwe - WebWriter Enterprise").Page("wwe - WebWriter Enterprise").ChildObjects(obj)[/b]
msgbox td_obj.count
' End Of Child Test


Attached Files
.doc   Error Msg.doc (Size: 27 KB / Downloads: 73)
Reply
#6
Not Solved
Hi subha,

you have forgot to use SET keyword.
MOdify your code as below.

SET td_obj=Browser("wwe - WebWriter Enterprise").Page("wwe - WebWriter
Reply
#7
Not Solved
Thanks for the help. That worked Smile

However, I was trying to identify the dynamic Child checkboxes, but made no progress. I believe if I am able to figure out with the checkboxes, similar process would apply for the dynamic child webedit too. This is what I have tried with 2 different approach. I have attached snapshot from the ObjectSpy for the 1st checkbox and the Editbox.

The 1st approach returned results but they where all "TABLE" for 'html tag' and blank for 'html id' as per snapshot of the ouput in the attached document. The 2nd Approch produced not result as the count was 0 (ZERO). Both the codes are as below.

Need your help and input.

Thanks,
Subha

First Try:
Code:
Set obj=Description.Create

obj("html tag").value="TABLE"
obj("name").value="WebTable"


set td_obj=Browser("wwe - WebWriter Enterprise").Page("wwe - WebWriter Enterprise").ChildObjects(obj)

msgbox td_obj.count
cnt = td_obj.count

Print "Count = "&cnt
For i = 0 to (cnt -1)
        WIth td_obj(i)
                   print "Item  : " & .GetROProperty("html tag") &" -- " & .GetROProperty("html id")
        End With
Next

Second Try:
Code:
Set obj=Description.Create

obj("class").value="WebCheckBox"
obj("html tag").value="INPUT"
obj("type").value="checkbox"

set td_obj=Browser("wwe - WebWriter Enterprise").Page("wwe - WebWriter Enterprise").ChildObjects(obj)

msgbox td_obj.count
cnt = td_obj.count

Print "Count = "&cnt
For i = 0 to (cnt -1)
        WIth td_obj(i)
                   print "Item  : " & .GetROProperty("html tag") &" -- " & .GetROProperty("html id")
        End With
Next


Attached Files
.doc   Dynamic Object_Result.doc (Size: 164.5 KB / Downloads: 74)
Reply
#8
Not Solved
Not sure if this is the right way to identify the dynamic Child Objects / Objects. This is was my last try. Need some help and direction.

I was trying to identify the dynamic Child checkboxes, but made no progress. I believe if I am able to figure out with the checkboxes, similar process would apply for the dynamic child webedit too. This is what I have tried with 2 different approach. I have attached snapshot from the ObjectSpy for the 1st checkbox and the Editbox.

The 1st approach returned results but they where all "TABLE" for 'html tag' and blank for 'html id' as per snapshot of the ouput in the attached document. The 2nd Approch produced not result as the count was 0 (ZERO). Both the codes are as below.

Please correct me where I went wrong.

Thanks,
Subha

First Try:
Code:
Set obj=Description.Create
obj("html tag").value="TABLE"
obj("name").value="WebTable"


set td_obj=Browser("wwe - WebWriter Enterprise").Page("wwe - WebWriter Enterprise").ChildObjects(obj)

msgbox td_obj.count
cnt = td_obj.count

Print "Count = "&cnt
For i = 0 to (cnt -1)
WIth td_obj(i)
print "Item : " & .GetROProperty("html tag") &" -- " & .GetROProperty("html id")
End With
Next

Second Try:
Code:
Set obj=Description.Create
obj("class").value="WebCheckBox"
obj("html tag").value="INPUT"
obj("type").value="checkbox"

set td_obj=Browser("wwe - WebWriter Enterprise").Page("wwe - WebWriter Enterprise").ChildObjects(obj)

msgbox td_obj.count
cnt = td_obj.count

Print "Count = "&cnt
For i = 0 to (cnt -1)
WIth td_obj(i)
print "Item : " & .GetROProperty("html tag") &" -- " & .GetROProperty("html id")
End With
Next


Attached Files
.doc   DynamicObject_Result.doc (Size: 164.5 KB / Downloads: 112)
Reply
#9
Not Solved
Hi,
Can u update ur second approach as given below and try.
Code:
obj("class").value="WebCheckBox"   change this to obj("micclass").value="WebCheckBox"

We do not use 'class' or 'Class Name' to check the Object Type in DP. We need to use micclass.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  virtual objects do not work kawagnes 0 1,095 08-28-2020, 12:02 PM
Last Post: kawagnes
  Could not create Java virtual machine TangShake 2 8,628 10-26-2017, 11:41 AM
Last Post: walshmagger
  Object Name Is Also A Dynamic Value zunebuggy 0 1,141 05-16-2017, 09:53 PM
Last Post: zunebuggy
  object spy not recognizing object.. pleaseeeee help Sonia Sadeque 3 3,425 12-22-2016, 02:42 PM
Last Post: ishan.mahajan@adp.com
  cannot create java virtual machine on QTP 12.02 version richa5685 0 1,961 02-23-2016, 11:18 AM
Last Post: richa5685

Forum Jump:


Users browsing this thread: 1 Guest(s)