Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Select Menu items
#1
Not Solved
Hello,

I have a web based application in which there is a menu bar, and i have to select an item from it.

Ex: Testing--> SDLC
I need a method which will accept the object details and will select SDLC option or if i pass another item details under another menu, it should select that as well.
AND
Testing-->Automation Testing--> QTP.
I have to select "QTP" here. I tried recording the menu, but it wasnt recognised. I need a generic function in which I will be passing the "QTP" object hierarchy details. Also, If I pass another object details say "Selenium" (Testing-->Automation Testing--> Selenium) , it should select that as well.

Please help me!!!!! I am quite new to QTP.
We are using UFT 11.53
Reply
#2
Not Solved
Option 1:
You can use the xpath of the menu item and click on the item directly. Check the below snippet (used to click on the 'Support Matrix -> Windows Support Matrix" menu item.
Code:
Browser().Page().WebElement("xpath:=//ul[@id="primary"]//a[text()='Windows Support Matrix']").Click

Option 2:
You can use the mouse over on until you hit the last item and then click on the last menu item in the input. Below is the skeleton of code (did not got a chance to execute, so please modify the function as per need.)
Code:
Public Function SelectMenuItem(oPage,sMenuPath)
    'Make sure the path contains submenu items and path is mentioned correctly
    If instr(sMenuPath,"->")>0  Then
        aMenuItems = Split(sMenuPath,"->")
    End If
    'Loop through the menu items and click on the last item
    For iMenuItem = lbound(aMenuItems) to Ubound(aMenuItems)-1
        oPage.WebElement("xpath:=//a[text()='" & aMenuItems(iMenuItem) & "']").FireEvent "onmouseover"
    Next
    oPage.WebElement("xpath:=//a[text()='" & aMenuItems(ubound(aMenuItems)) & "']").Click
End Function

Let me know if you need any more help on this.
Thanks,
SUpputuri
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [UFT] [WPF] DataGrid: get items of ControlTemplate robertosalemi 0 3,484 07-14-2016, 07:52 PM
Last Post: robertosalemi
  SwfList: unchecked all items robertosalemi 0 1,952 12-21-2015, 03:46 PM
Last Post: robertosalemi
  Object Spy not detecting items in C ICL AndyBSG 5 4,344 11-28-2014, 09:32 PM
Last Post: AndyBSG
  to verify the presence of items in wpf application Priyanka2 0 2,427 10-10-2013, 03:52 PM
Last Post: Priyanka2
At MISSING MENU ITEMS IN QTP ahmet571 2 4,047 11-27-2012, 02:42 PM
Last Post: Prashant kandukuri

Forum Jump:


Users browsing this thread: 1 Guest(s)