Micro Focus QTP (UFT) Forums
unable to get the webbuttons count(child objects) - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: unable to get the webbuttons count(child objects) (/Thread-unable-to-get-the-webbuttons-count-child-objects)



unable to get the webbuttons count(child objects) - qtpexpert - 07-04-2012

Hi guys,

In my application in side the frame few buttons are available like add, delete, filter...

I could recognize the frame by using index number. now i want to count the no.of buttons in the frame(it is grid)

Here I can able to click the single button individually with name property.
I f i follow this i have to write function for each button individually. I do not want this.

If i have buttons count based on that count i will click on particular button.

I tried with the following code but i'm getting the type mismatch error.


Code:
Set WebBrowserDesc=Description.Create
                            WebBrowserDesc("application version").value="internet explorer 8"
                            WebBrowserDesc("title").value="http://172.16.220.24/Proof/PageManager.aspx"
                            
                            Set WebPageDesc=Description.Create
                            WebPageDesc("url").value="http://172.16.220.24/Proof/PageManager.aspx"

Set WebFrameDesc=Description.Create
                            WebFrameDesc("html tag").value="IFRAME"
                            'WebFrameDesc("title").value="PROOF - ISpace"
                            WebFrameDesc("Index").value="5"

Set WeButtonDesc=Description.Create
                             WeButtonDesc("type").value="submit"
                             WeButtonDesc("html tag").value="INPUT"
                             'WeButtonDesc("name").value="Add"
                               WeButtonDesc("micclass").value="WebButton"

                                Set objwebbutton=Browser(WebBrowserDesc).Page(WebPageDesc).Frame(WebFrameDesc).ChildObjects(WebButtonDesc)                    
                                msgbox objwebbutton.Count

please find the attachement for error.

any one knows the solution.
pls providethe solution ASAP.

Thanks in Advance!


RE: unable to get the webbuttons count(child objects) - Ankesh - 07-04-2012

Try the below

Code:
Set objBrowser=Description.Create
objBrowser("title").value=".*"

Set objPage=Description.Create
objPage("title").value=".*"

Set objButton=Description.Create
objButton("type").value="submit"
objButton("html tag").value="INPUT"
objButton("name").value="Add"

Set objChildObjects=Browser(objBrowser).Page(objPage).Childobjects(objButton)
msgbox objChildObjects.count

'Release the objects once operation is over
Set objBrowser=Nothing
Set objPage=Nothing
Set objButton=Nothing
Set objChildObjects=Nothing


Regards,
Ankesh




RE: unable to get the webbuttons count(child objects) - qtpexpert - 07-05-2012

It is working fine now without doing any changes.


Thanks for your solution.
without doing any changes in my script it is working fine.