Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GetTOProperties count
#1
Not Solved
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.
Code:
Set val5 = SwfWindow("Form").SwfObject("toolBar").GetTOProperties
Set a = val5.Count()
Reporter.ReportEvent micdone,"Test1",a
2.
Code:
Set val5 = SwfWindow("Form").SwfObject("toolBar").ChildObjects
Set b = val5.Count()
Reporter.ReportEvent micdone,"Test2",b
3.
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.


Attached Files Image(s)
   
Reply
#2
Not Solved
Update2: did remove Set from "a = val5.count" and executed below queries.
1
Code:
Set val5 = SwfWindow("Production Analyst").SwfObject("toolBar").GetTOProperties
a = val5.count
Reporter.ReportEvent micdone,"Test",a
2
Code:
Set val5 = SwfWindow("Production Analyst").SwfObject("toolBar").ChildObjects
b = val5.Count()
Reporter.ReportEvent micdone,"Test2",b
3
Code:
Set val5 = SwfWindow("Production Analyst").SwfObject("toolBar").Object.Items
c = val5.Count()
Reporter.ReportEvent micdone,"Test3",c

Following values were returned:
1. 1
2. 0
3. 20

That means I have to use 3rd option
Code:
Set val5 = SwfWindow("Production Analyst").SwfObject("toolBar").Object.Items

How will i get to explore all the values in val5?
Guys,

I Executed
Code:
Set val5 = SwfWindow("Production Analyst").SwfObject("toolBar").Object.Items
c = val5.Count()
Reporter.ReportEvent micdone,"Test3",c

Output = 20

As shown in attachment, window "Smat Item Collection Editor" has 20 item.
I am not sure, how to get to 16th item.

when i use
"Set s = val5(0).Item" or "val5(0)", I get the below error:
Object doesn't support this property or method: 'val5'

How do I access values in val5?
Reply
#3
Not Solved
Val5(0) will give you the value of first item in the object.
Code:
For i = 0 to Val5.Count
     msgbox Val5(i)
Next
Thanks,
SUpputuri
Reply
#4
Not Solved
Thanks Supputuri.
When i execute below line error is thrown:
msgbox Val5(0)
ERROR:
Object doesn't support this property or method: 'val5'
Reply
#5
Not Solved
hey sorry,

there was a typo, we have to define the method which we want to retrieve.

eg.
Code:
msgbox Val5(0).GetROProperty("innertext")
     msgbox Val5(0).GetROProperty("Name")

Please let me know if you need any further information.
Thanks,
SUpputuri
Reply
#6
Not Solved
Thanks mate, but it did not work.

I executed below code

Code:
Set Val5 = SwfWindow("Form").SwfObject("toolBar").Object.Items
c = Val5.Count()
Reporter.ReportEvent micdone,"Test3",c
msgbox Val5(0).GetROProperty("index")

Following error was thrown:
Object doesn't support this property or method: 'Val5'
Line (80): "msgbox Val5(0).GetROProperty("index")".

if i type Val5(0). -->QTP does not hint me with option.
if i type Val5. -->QTP gives me hint
so I typed Val5.Get --> QTP did not promt me with GetROProperty, options prompted by QTP is as shown in attachment.


Attached Files Image(s)
   
Reply
#7
Not Solved
Can you please help me out. I have to get this working by tomorrow. Thanks Steve.
Reply
#8
Not Solved
HI Steve,

Sorry for the late replay.

The thing is it will not work because we don't have any run time property called "index". You can use GetROProperty() for only the run time properties.

I don't understand why you are pointing to the index number, help to understand your requirement clearly so that we can provide the answer.
Thanks,
SUpputuri
Reply
#9
Not Solved
I do not like Analog recofing, so the question is, when is the good measure to take when you can not access the object or when you can not record using context sensitive mode.

Another option, when toolbar does not have "index" is to use Analog recording or low level recording and below is what was recorded when analog method was choosen
Code:
SwfWindow("FormName").SwfObject("toolBar").Click 559,20

What do you recommend?
Reply
#10
Not Solved
hi Supputuri,

I did not get any reply from you. I have used Mouse coridicates to locate the button and click particular button on toolbar, but if i run in different computer with bigger or small screen test will break. Do you have any recomendation, do you have any better way to handle this kind of tests?

I have run in to another problem, hope you will be able to help me out.
I have result displayed in grid and QTP is identifying the grid as a generic object (SwfObject:grid) and not really a toolbar (Swfgrid)
How can i get the value out of the grid --> rows --> cell and compare? Please find the first attachment, I would like to get the grid, I would like to get Time4 column, 2nd row, cell value and compare with expected result.

As shown in second attachment, Dot Net Spy shows properties of the row, but I can not find the values displayed in that row cell.

As shown in thrid attachment, I typed
Code:
SwfWindow("FormName").SwfObject("grid").Object.DataRows.
varous
options as displayed in screen shot is displayed.

when I use Test Complete, (another automaiton tool) obect spy of Test complete shows the Row values. Below is the code to access data row, cell values in Test Complete.
Code:
Aliases["System"]["FormName"]["Host"]["Browser"]["Base"]["Main"]["WinFormsObject"]("viewManager")["WinFormsObject"]("StandardView")["WinFormsObject"]("gridPanel")["WinFormsObject"]("grid")["DataRows"]["Item"](0)["Cells"]["Item"](0)
Below code is equal to SwfWindow("FormName").SwfObject("grid") code of QTP.
Code:
"Aliases["System"]["FormName"]["Host"]["Browser"]["Base"]["Main"]["WinFormsObject"]("viewManager")["WinFormsObject"]("StandardView")["WinFormsObject"]("gridPanel")["WinFormsObject"]("grid")"

and Datarows is common in QTP and Testcomplete.

Test complete recognizes it as ("grid")["DataRows"]["Item"](0)["Cells"]["Item"](0) but QTP does not.

In QTP I can access as shown in 3rd attachment:
Code:
SwfWindow("FormName").SwfObject("grid").Object.DataRows.item
But thows an error, when I type bracket in front of item, example below
Code:
SwfWindow("FormName").SwfObject("grid").Object.DataRows.item(0)
Error will be thrown.

Please help me, I am running out of time. Is it possible for you use team viewer to access my machine and help me or I request that any one of your team member to help me.


Attached Files Image(s)
           
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Diff. between page checkpoint link count and childobj count anemuday 0 2,266 07-20-2008, 10:11 PM
Last Post: anemuday
  Using GetTOProperties & Count function Akhila 1 3,758 07-07-2008, 11:44 AM
Last Post: surya_7mar

Forum Jump:


Users browsing this thread: 1 Guest(s)