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.
[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.