Micro Focus QTP (UFT) Forums
How to count the number of submenus of a drop down top menu on a website? - 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: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to count the number of submenus of a drop down top menu on a website? (/Thread-How-to-count-the-number-of-submenus-of-a-drop-down-top-menu-on-a-website)



How to count the number of submenus of a drop down top menu on a website? - pradeep singh - 09-19-2012

Hi to All,

Could anybody tell me how to count the sub menus of a drop down menu of a website?

For example:there is a top drop down menu name as Clothes
and its drop down submenus which comes on mouse over are Men wear,Ladies wear,children wear etc.


RE: How to count the number of submenus of a drop down top menu on a website? - sshukla12 - 09-20-2012

Could you please post the snap shot of ur requirement. It would be helpful to understand what actually scenario is.

Regards,
Sankalp


RE: How to count the number of submenus of a drop down top menu on a website? - pradeep singh - 09-20-2012

Hi ,
Below is my script  and I want to get the all submenus names under top drop down menu on site http://divinevines.ca/. Please find the screenshot to understand the scenario.
Code:
Systemutil.CloseProcessByName "iexplore.exe"

Systemutil.Run "iexplore.exe","http://divinevines.ca/"

wait (3)
'a=Browser("Vancouver Flower Shop").Page("Vancouver Flower Shop").WebElement("fall flowers fresh arrangement").GetROProperty("
innertext")

Set omenu=Browser("Vancouver Flower Shop").Page("Vancouver Flower Shop").Object

Set m=omenu.getelementsbyclassname("down")

msgbox "Total top menus are  :"& m.length

' To count the submenus of 2nd menu as 1st has not submenus
For i=1 to m.length
   msgbox m(i).innertext
   zinnertext=m(i).innertext


Set desc=Description.Create
desc("micclass").value="Link"


   Browser("Vancouver Flower Shop").Page("Vancouver Flower Shop").WebElement("innertext:="&zinnertext,"html tag:=SPAN").FireEvent "onmouseover"
  set submenucount= Browser("Vancouver Flower Shop").Page("Vancouver Flower Shop").WebElement("innertext:="&zinnertext,"html tag:=UL").childobjects(desc)
  msgbox "submenu count is "& submenucount.count



RE: How to count the number of submenus of a drop down top menu on a website? - sshukla12 - 09-20-2012

Hi,

On my system I am not able to see the drop down list.

Refer to the attachment


RE: How to count the number of submenus of a drop down top menu on a website? - pradeep singh - 09-20-2012

Please open  this url in mozilla/chrome/IE 8 /other browsers http://divinevines.ca

See top menus on home page and mouse over on "fresh arrangements","summer flowers " etc.


RE: How to count the number of submenus of a drop down top menu on a website? - sshukla12 - 09-20-2012

Won't be able to test on mozilla since don't have patch to support firefox.
I will try to check it on IE 8

Regards,
Sankalp