Hi Shannon,

I have dealt with JS dropdowns and in some cases you need to expand the
list and then select the item.

In the example you provided I don't see this element:

browser.ul(:id,"ctl00_ChangeCustodyMenu")

though it is shown as a list item <li>.

You might need to do something like this:

browser.ul(:index=><0 or 1 not sure>).click
then
browser.a(:text,'Drop-off").click


Looking at the html is this a dropdown inside of dropdown?

I use watir-webdriver but that because we test multi browsers.

I hope this helps.

Joe


On Thu, Jun 27, 2013 at 7:47 PM, <scrawf...@foray.com> wrote:

> Hey- new to Watir and trying to select items in an unordered JS list.  I'm
> using watir-classic and testing in IE.
>
> Here's the code:
> <div id="ctl00_content" style="text-align: left; background: #fff;">
>  <script type="text/javascript"> … </script>
>  <div id="ctl00_breadCrumb" class="navBar"> … </div>
>  <div id="ctl00_menuBarUpdatePanel">
>   <div id="ctl00_menuBar" class="menuBar">
>    <table width="100%" cellspacing="0" cellpadding="0" border="0">
>     <tbody>
>      <tr>
>       <td>
>        <div class="menu">
>         <ul>
>          <div id="ctl00_MenuBarButtons" class="menuBarButtons">
>           <li id="ctl00_AddMenu" style="display:inline;"> … </li>
>           <li id="ctl00_ChangeCustodyMenu" style="display:inline;">
>              Change Custody
>            <ul>
>             <li id="ctl00_CheckInMenuItem" style="display:inline;">
>             <li id="ctl00_CheckOutMenuItem" style="display:inline;">
>      <li id="ctl00_ReceiveMenuItem" style="display:inline;">
>      <li id="ctl00_ReturnMenuItem" style="display:inline;">
>             <li id="ctl00_DropOffMenuItem" style="display:inline;">
>        <a onclick="window.location =
> '/WebSite/PropertyItems.aspx?action=dropOff'; return false;" href="">
>                 Drop-off
>
> I'm trying to select Drop-off (the last item in the list) and have
> attempted using the following:
> browser.ul(:id,"ctl00_ChangeCustodyMenu").li(:text,"Drop-off").click
> browser.div(:id, "ctl00_MenuBarButtons").li(:index, 1).link(:index,
> 4).click
>
> ... but then read that I can't select items in Watir unless I can see it.
> I started to test with fire_event("onclick") with the following tip: "I
> firstly need to fire_event("onmouseover") which selects the item then
> fire_event("onclick")."
>
> So I try this:
> browser.li(:id,"ctl00_ChangeCustodyMenu").fire_event("onclick")
>
> This method will flash the 'Change Custody' menu, but not drop down the
> list with the 'Drop-down' item. Hence, I am not able to select the item on
> the list. The Change Custody list will drop once the user hovers over the
> menu.
>
> How do I select the JS drop-down list and select an item in an unordered
> list? Do I need to use webdriver's select_list, or am I just missing
> something? Watir-classic seems pretty straight forward and should handle
> this, but maybe the JS structure is tricky here.
>
> Thanks for the help!
> Shannon
>
>
> --
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> watir-general@googlegroups.com
> http://groups.google.com/group/watir-general
> watir-general+unsubscr...@googlegroups.com
>
> ---
> 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 watir-general+unsubscr...@googlegroups.com.
> 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.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
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 watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to