06-05-2012, 06:13 PM
(This post was last modified: 06-05-2012, 07:08 PM by Steve.Govinakovi.)
Hi Guys,
I am working on windows forms. .Net 4 framework and QTP 10, I have installed the frameowrk before QTP10.
QTP is identifying the toolbar as a generic object (SwfObject:Toolbar) and not really a toolbar (SwfToolbar)
Object spy did not get the properties I was looking for, so I used ".Net Windows forms spy". I was able to see the properties of toolbar.
I got all the properties of toolbar using below code, but, count() fails with error Object required: 'val5.Count()'
(toolbar.properties.count(), as shown in below example)
1.
2.
3.
ERROR:
4.
Below example worked
5.
ERROR: object required is thrown.
Can you please help me QTP to click an item "Insert Sample" in items(16) as shown in attachment
Also if possible, why is error thrown in example 5, when i add "Set"?
Thanks,
Steve
Update:
Value for a is coming up as 1, which is incorrect, it has got more than one property.
I am working on windows forms. .Net 4 framework and QTP 10, I have installed the frameowrk before QTP10.
QTP is identifying the toolbar as a generic object (SwfObject:Toolbar) and not really a toolbar (SwfToolbar)
Object spy did not get the properties I was looking for, so I used ".Net Windows forms spy". I was able to see the properties of toolbar.
I got all the properties of toolbar using below code, but, count() fails with error Object required: 'val5.Count()'
(toolbar.properties.count(), as shown in below example)
1.
Code:
Set val5 = SwfWindow("Form").SwfObject("toolBar").GetTOProperties
Set a = val5.Count()
Reporter.ReportEvent micdone,"Test1",a
Code:
Set val5 = SwfWindow("Form").SwfObject("toolBar").ChildObjects
Set b = val5.Count()
Reporter.ReportEvent micdone,"Test2",b
Code:
Set val5 = SwfWindow("Form").SwfObject("toolBar").Object.Items
Set c = val5.Count()
Reporter.ReportEvent micdone,"Test3",c
ERROR:
Code:
Object required: 'val5.Count()'
Line (67): "Set a = val5.Count()".
4.
Below example worked
Code:
val = SwfWindow("Form").SwfObject("toolBar").GetROProperty("Enabled")
Reporter.ReportEvent micdone,"Test",val
5.
Code:
SwfWindow("Form").SwfObject("toolBar").GetROProperty("items(16)")
Above executes without error, but when execute below
Set val6 = SwfWindow("Form").SwfObject("toolBar").GetROProperty("items(16)")
ERROR: object required is thrown.
Can you please help me QTP to click an item "Insert Sample" in items(16) as shown in attachment
Also if possible, why is error thrown in example 5, when i add "Set"?
Thanks,
Steve
Update:
Code:
Set val5 = SwfWindow("Form").SwfObject("toolBar").GetTOProperties
a = val5.count
Reporter.ReportEvent micdone,"Test",a
Value for a is coming up as 1, which is incorrect, it has got more than one property.