Micro Focus QTP (UFT) Forums
How to select item within WebMenu - 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: How to select item within WebMenu (/Thread-How-to-select-item-within-WebMenu)



How to select item within WebMenu - learnasugo - 09-07-2016

hi,

I need help. I had figured out a way to select links using descriptive programming and am now not able to select an item within a WebMenu.
I cannot loop through theitems within that WebMenu .
Properties of the WEbMenu include:

top level items: Email;SMS;Telephone (Land Line);Postal;Cell Phone
outetext: EmailSMSTelephone (Land Line)PostalCell Phone

How can I loop through and select oneof these options?


RE: How to select item within WebMenu - supputuri - 09-28-2016

Can you please share the screenshot of the SPY and it would be great if you can share the page link (provided it a generic website but not the client website page).


RE: How to select item within WebMenu - venkatesh9032 - 10-04-2016

Hi,

If you spy on the webmenu u will get all items options so use below syntax.

starValues = B().Pg().webmenu().getropropert("all items")

''Webmenu items will be segregated by space or semi coloumn mostly. In that case split the according to delimeter shown in object spy

strValArray = Split(starValues ,; )
Msgbox Ubound(strValArray)

''Use for loop to get values and add conditional stmt to select values

For i= 0 to ubound(strValArray )

Print Trim(strValArray (i))

Next

'''Please tell me if i answered ur question


RE: How to select item within WebMenu - learnasugo - 10-05-2016

This is what my code looks like:
 Elements =  Browser().Page().WebElement().GetROProperty("all items")
 iTemCount =  Elements.Count

        For intCounter = 0 to iTemCount - 1
            WebValue = Elements(intCounter).GetROProperty("innertext")
            If Instr (1LCase(WebValue)LCase(CrReg)) Then
            MsgBox CrReg
                Setting.WebPackage("ReplayType") = 2
                Elements(intCounter).Click  --------------This is where my code fails. i.e I cannot click on the desired value
                Setting.WebPackage("ReplayType") = 1
                Exit For
            End If
        Next


RE: How to select item within WebMenu - learnasugo - 10-11-2016

(10-04-2016, 09:21 PM)Hi,This is what my code looks like: Wrote:  Elements =  Browser().Page().WebElement().GetROProperty("all items")
 iTemCount =  Elements.Count

        For intCounter = 0 to iTemCount - 1
            WebValue = Elements(intCounter).GetROProperty("innertext")
            If Instr (1LCase(WebValue)LCase(CrReg)) Then
            MsgBox CrReg
                Setting.WebPackage("ReplayType") = 2
                Elements(intCounter).Click  --------------This is where my code fails. i.e I cannot click on the desired value
                Setting.WebPackage("ReplayType") = 1
                Exit For
            End If
        Next