for example one window is there, the window contains how
many edit box's i want script? i know the script but that is
not exact answer....
The script is like this ..........

set a=description.creation()
a("Native class")="WinEdit"
b=window("Flight Reservation").childobject(a).count
msgbox b

Answers were Sorted based on User's Feedback



for example one window is there, the window contains how many edit box's i want script? i know..

Answer / saravanaraja

This Code is working Perfect:

Set desc=Description.Create()
desc("micclass").Value="WebEdit"
Set Edit=Browser("Title:=.*").Page("Title:=.*").ChildObjects
(desc)
msgbox Edit.Count

Is This Answer Correct ?    2 Yes 0 No

for example one window is there, the window contains how many edit box's i want script? i know..

Answer / softwaretester4u

use this example for windows alos
Step1: Set Objects = Browser("BrowserName").Page
("PageName").ChildObjects

Step2: Objectcount = Objects.count
Linkcount = 0
Step3: For i = 1 to Objectcount-1

Link = Objects(i).GetROProperty("micclass")
If Link = "Link" Then
Linkcount = Linkcount+1
msgbox Linkcount
End If
Next
msgbox Linkcount ' It show total number links

Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Set Lists = Browser("Google").Page("Google").ChildObjects
(oDesc)
NumberOfLists = Lists.Count()
linkcnt = 0
For i = 0 To NumberOfLists - 1
linkcnt = linkcnt+1

Next
msgbox linkcnt

Is This Answer Correct ?    1 Yes 0 No

for example one window is there, the window contains how many edit box's i want script? i know..

Answer / rajaputra

''''''''Try for this, It will give you all elements/items
count in the webpage'''''''''''''''''''''

url="http://my.naukri.com/manager/createacc2.php?othersrcp=5421&wExp=N"

If Browser("index:=0").Exist(1) then' If Browser is already
opened
a = Browser("index:=0").GetROProperty("hwnd")
Browser("hwnd:=" & a).Navigate(url)
Browser("hwnd:=" & a).Sync
wait(2)
Else' If Browser is not opened
SystemUtil.Run"IEXPLORE.exe"
a = Browser("index:=0").GetROProperty("hwnd")
Browser("hwnd:=" & a).Navigate(url)
Browser("hwnd:=" & a).Sync
wait(2)
End If

Set Editobj=Description.Create()'For WebEdits
Editobj("html tag").value="INPUT"
Editobj("type").value="text"

Set Butobj = Description.Create()'For Buttons
Butobj("html tag").value = "INPUT"
Butobj("type").value="submit"

Set Listobj=Description.Create()'For Web Lists
Listobj("html tag").value="SELECT"

Set Linkobj=Description.Create()'For Link
Linkobj("html tag").value="A"'

Set Checkboxobj=Description.Create()'For Checkboxes
Checkboxobj("html tag").value="INPUT"
Checkboxobj("type").value="checkbox"

Set Radioobj=Description.Create()'For Radio Buttons
Radioobj("type").value="radio"
Radioobj("html id").value="ctctype_i"


Set Edits = browser("hwnd:="
&a).Page("title:=.*").ChildObjects(Editobj)
Set Buttons = browser("hwnd:="
&a).Page("title:=.*").ChildObjects(Butobj)
Set Lists = browser("hwnd:="
&a).Page("title:=.*").ChildObjects(Listobj)
Set Links = browser("hwnd:="
&a).Page("title:=.*").ChildObjects(Linkobj)
Set Checks = browser("hwnd:="
&a).Page("title:=.*").ChildObjects(Checkboxobj)


Set Radios = browser("hwnd:="
&a).Page("title:=.*").ChildObjects(Radioobj)

msgbox "Total EditBoxes are : "&Edits.count
msgbox "Total Button are : "&Buttons.count
msgbox "Total Lists are : "&Lists.count
msgbox "Total Links are : "&Links.count
msgbox "Total checkBoxes are : "&Checks.count
'msgbox "Total RadioButtons are : "&r
msgbox "Total RadioButtons are : "&Radios.count+1


''''''If you have any doubts reply to this thread'''''''''''

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More QTP Interview Questions

hai, i completed my b.tech in 2010 with 62.3%. i having knowledge on manual testing and Qtp. i want Relavent experience in testing.watever may be d salary i dont bother..I just want to gain knowledge. i dont have good communication skills.

0 Answers  


How can we upload pdf files in qtp?

1 Answers   Syntel, TCS,


Is it possible to refer the same object for referring more than one object that are of different class using the descriptive programming approach? Suppose my code is 'To create the object named as obj Set obj=Description.Create() 'To define the values obj("title").value="IE" obj("type").value="text" obj("html tag").value="INPUT" 'To set the value Browser("IE").Page("Yahoo").WebEdit(obj).Set "xyz" Can I refer the "obj" object for the three objects like Browser,page and webedit objects? If so how?

0 Answers  


Can we continue functionality testing without framework?

4 Answers  


How the objecs properties are identified?Tell me in Hierarchical order?

5 Answers   IBM,






HOW TO FIND WEBTABLE? HOW TO RETRIVE THE WEBTABLE VALUES? PLZ TELL ME THE PROCEDURE.

2 Answers   TCS,


What is keyword driven framework?

0 Answers  


I want to do Certification course in QTP. For this I request you to suggest the best Tutorial in PDF format, if possible, kinldy mail PDF file to my mail-ID: ramakrishna908@gmail.com Regards, krishna.

0 Answers  


On the website, the protocol has been changed https: to https what you will do? Tell me your approach?

0 Answers  


What is the Limitations of Testing ?

4 Answers   TCS,


What is checkpoints for qtp?

0 Answers  


What issues come up in test automation, and how do you manage them?

0 Answers  


Categories