Sorry my mistake here. Sub Menu 1 was a dummy name. i replaced it with real name and now it is working fine. Great *Thanks a lot Joe for your kind help. Much appreciated.*
On Wed, Jan 30, 2013 at 11:51 PM, Joe Fleck <[email protected]> wrote: > Okay. > > you need to change my @browser to what you initialized your browser as. > > Joe > > # if you have to sign in do that > > > On Wed, Jan 30, 2013 at 2:48 PM, Sohail Mirza <[email protected]> wrote: > > Joe, > > > > i tried following > > > > @browser.li(:class=>"potato-menu-item potato-menu-has-vertical").click > > @browser.a(:text=>'Sub Menu 1').click > > > > D:/Watir/Examples/Test1.rb:4:in `<main>': undefined method `li' for > > nil:NilClass > > (NoMethodError) > > > > > > > > On Wed, Jan 30, 2013 at 11:43 PM, Joe Fleck <[email protected]> > wrote: > >> > >> Hi Sohail, > >> > >> Yes. > >> > >> @browser.li(:class=>"potato-menu-item potato-menu-has-vertical").click > >> @browser.a(:text=>'Sub Menu 1').click > >> > >> > >> Sometimes it is difficult to run these steps in irb. I would suggest > >> creating a method then calling it in irb. > >> > >> <<do first>> > >> > >> def click_sub_menu() > >> @browser.li(:class=>"potato-menu-item > potato-menu-has-vertical").click > >> @browser.a(:text=>'Sub Menu 1').click > >> end > >> > >> <then call it> > >> click_sub_menu > >> > >> > >> Hope this helps. > >> > >> Joe > >> > >> > >> On Wed, Jan 30, 2013 at 2:35 PM, Sohail Mirza <[email protected]> wrote: > >> > Joe, > >> > > >> > Are you asking for this? > >> > i used Chrome Develope Tool and found the following. > >> > > >> > > >> > <li class="potato-menu-item potato-menu-has-vertical"> > >> > Main1 > >> > <ul class="subMenu potato-menu-group potato-menu-vertical" > >> > style="left: 0px; display: none;"> > >> > > >> > <li class="potato-menu-item"> > >> > > >> > <a href="/MyDemoTest/Menu/LoadView?menuItemKey=1" > >> > onclick="ShowLoadingIndicator();">Sub Menu 1</a> > >> > > >> > </li> > >> > <li class="potato-menu-item"> > >> > > >> > <a href="/MyDemoTest/Menu/LoadView?menuItemKey=6" > >> > onclick="ShowLoadingIndicator();">Sub Menu 2</a> > >> > > >> > </li> > >> > <li class="potato-menu-item"> > >> > > >> > <a href="/MyDemoTest/Menu/LoadView?menuItemKey=7" > >> > onclick="ShowLoadingIndicator();">Sub Menu 3</a> > >> > > >> > </li> > >> > > >> > </ul> > >> > > >> > </li> > >> > > >> > > >> > > >> > > >> > On Wed, Jan 30, 2013 at 10:58 PM, Joe Fleck <[email protected]> > >> > wrote: > >> >> > >> >> Hi, > >> >> > >> >> First thing.. make sure you use firebug or developer tool to get the > >> >> html. > >> >> Don't use view source. > >> >> > >> >> You will need to first expose the submenu and then select the submenu > >> >> item > >> >> you want. > >> >> > >> >> Repost the html code here and we will be better able to help you. > >> >> > >> >> Joe > >> >> > >> >> On Jan 30, 2013 1:55 PM, "Sohail Mirza" <[email protected]> wrote: > >> >>> > >> >>> Hi folks, > >> >>> > >> >>> I need to select sub menu item. How can i automate this? I am using > >> >>> Watir-Classic gem. > >> >>> > >> >>> The view source shows following > >> >>> > >> >>> <li> > >> >>> <a href="/MyDemoTest/Menu/LoadView?menuItemKey=1" > >> >>> onclick="ShowLoadingIndicator();">Test Management</a> > >> >>> </li> > >> >>> > >> >>> > >> >>> Thanks, > >> >>> > >> >>> -- > >> >>> -- > >> >>> Before posting, please read http://watir.com/support. In short: > search > >> >>> before you ask, be nice. > >> >>> > >> >>> [email protected] > >> >>> http://groups.google.com/group/watir-general > >> >>> [email protected] > >> >>> > >> >>> --- > >> >>> You received this message because you are subscribed to the Google > >> >>> Groups > >> >>> "Watir General" group. > >> >>> To unsubscribe from this group and stop receiving emails from it, > send > >> >>> an > >> >>> email to [email protected]. > >> >>> For more options, visit https://groups.google.com/groups/opt_out. > >> >>> > >> >>> > >> >> > >> >> -- > >> >> -- > >> >> Before posting, please read http://watir.com/support. In short: > search > >> >> before you ask, be nice. > >> >> > >> >> [email protected] > >> >> http://groups.google.com/group/watir-general > >> >> [email protected] > >> >> > >> >> --- > >> >> You received this message because you are subscribed to the Google > >> >> Groups > >> >> "Watir General" group. > >> >> To unsubscribe from this group and stop receiving emails from it, > send > >> >> an > >> >> email to [email protected]. > >> >> For more options, visit https://groups.google.com/groups/opt_out. > >> >> > >> >> > >> > > >> > > >> > -- > >> > -- > >> > Before posting, please read http://watir.com/support. In short: > search > >> > before you ask, be nice. > >> > > >> > [email protected] > >> > http://groups.google.com/group/watir-general > >> > [email protected] > >> > > >> > --- > >> > You received this message because you are subscribed to the Google > >> > Groups > >> > "Watir General" group. > >> > To unsubscribe from this group and stop receiving emails from it, send > >> > an > >> > email to [email protected]. > >> > For more options, visit https://groups.google.com/groups/opt_out. > >> > > >> > > >> > >> -- > >> -- > >> Before posting, please read http://watir.com/support. In short: search > >> before you ask, be nice. > >> > >> [email protected] > >> http://groups.google.com/group/watir-general > >> [email protected] > >> > >> --- > >> You received this message because you are subscribed to the Google > Groups > >> "Watir General" group. > >> To unsubscribe from this group and stop receiving emails from it, send > an > >> email to [email protected]. > >> For more options, visit https://groups.google.com/groups/opt_out. > >> > >> > > > > -- > > -- > > Before posting, please read http://watir.com/support. In short: search > > before you ask, be nice. > > > > [email protected] > > http://groups.google.com/group/watir-general > > [email protected] > > > > --- > > You received this message because you are subscribed to the Google Groups > > "Watir General" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to [email protected]. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > -- > -- > Before posting, please read http://watir.com/support. In short: search > before you ask, be nice. > > [email protected] > http://groups.google.com/group/watir-general > [email protected] > > --- > You received this message because you are subscribed to the Google Groups > "Watir General" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
