I'm not sure that #click_no_wait is needed. Send me the actual html code
instead. Do it somehow like this:
ie.link(:id, "launchIndustry").click_no_wait # this bottom is to launch the
form - attached
container = ie.div(:id, "industry")
ie.wait_until {container.present?} # does this mean that the view on the
screenshot is visible now?
File.open("page.html", "w") {|f| f.puts ie.html}

Now, send us the "page.html" :)

Jarmo

On Mon, Aug 29, 2011 at 7:18 PM, M <[email protected]> wrote:

> Thanks Jarmo,
>
> I tried to use your solutions with no luck - i still can't locate the
> elements. Here is my code and the HTML code, I also attached a screen shot
> of the page so you know the type of pop up that I am dealing with. any help
> is appreciated
>
> ie.link(:id, "launchIndustry").click_no_wait # this bottom is to launch the
> form - attached
> container = ie.div(:id, "industry")
> ie.wait_until {container.present?}
> ie.li(:id => "industry_Technology_&_Internet").when_present.click
> ie.li(:id => "supersector_Technology_&_Internet").when_present.click
> ie.li(:id => "sector_Software_&_Computer_Services").when_present.click
> ie.li(:id => "subsector_Computer_&_IT_Services").when_present.click
> ie.button(:src, /btn_continueHover.png/).click
> puts 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX DONE page1
> X1XXXXXXXXXXXXXXXXXXXXXXXXXXXX'
> ie.li(:id => "busiArea_IT_/_Engineering").when_present.click
> ie.li(:id => "funcArea_Information_Technology").when_present.click
> ie.li(:id => "specFunction_Software_Engineering").when_present.click
> ie.button(:src, /btn_continueHover.png/).click
> puts 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX DONE page2
> X1XXXXXXXXXXXXXXXXXXXXXXXXXXXX'
>
>
> HTML Code: Notice that the UL and IL are empty.
>
> <div id="overlay" class="hidden">
>
>
>       <div id="industry" class="modal hidden">
>
>               <form action="#" method="post" class="active" 
> id="industryModalForm">
>
>
>                       <div class="page1 clearfix">
>                       <h2 style="background: 
> url(/static/images/blue_gradient.png) repeat-x;font-size: 
> 1.5em;margin-bottom: 0;padding-top: 9px;padding-bottom: 0px;"><a href="#" 
> class="industryModalClose" style="float: right;padding-right: 10px;"><a 
> href="#" class="industryModalClose" style="float: right;padding-right: 
> 10px;"><img src="/static/images/icon_modal_close.png" alt="close"/></a>Select 
> Industry<span>Page 1 of 2</span></h2>
>
>
>                               <p class="heading">Please specify the industry 
> and sector for <strong class="company"></strong> by making a selection in 
> <em>all four boxes</em>. A company's sector is determined by its source of 
> revenue or where it generates most of its revenue.</p>
>
>                               <dl class="first" id="primary_list" 
> style="padding-left: 15px;">
>
>                                       <dt>Primary Industry</dt>
>                                       <dd>
>                                               <ul>
>                                               </ul>
>
>                                       </dd>
>                               </dl>
>                               <dl id="supersector_list">
>
>                                       <dt>Supersector</dt>
>                                       <dd>
>                                               <ul>
>
>                                               </ul>
>                                       </dd>
>                               </dl>
>                               <dl id="sector_list">
>
>                                       <dt>Sector</dt>
>
>                                       <dd>
>                                               <ul>
>
>                                               </ul>
>                                       </dd>
>                               </dl>
>                               <dl id="subsector_list">
>
>                                       <dt>Subsector</dt>
>                                       <dd>
>
>                                               <ul>
>
>                                               </ul>
>                                       </dd>
>                               </dl>
>                               <div class="buttons" style="margin: 0px 0px 
> 10px;padding-left: 20px;width: 100%;">
>
>
>                                       <input type="image" 
> src="/static/images/btn_continueDisabled.png" alt="Continue" height="39" 
> width="113" disabled>
>
>
>                                       <a href="#" class="goback" style="left: 
> 170px;top: -8px;">Cancel</a>
>
>
>                               </div>
>
>                       </div>
>                       <div class="page2 hidden clearfix">
>
>                       <h2 style="background: 
> url(/static/images/blue_gradient.png) repeat-x;font-size: 
> 1.5em;margin-bottom: 0;padding-top: 9px;padding-bottom: 0px;"><a href="#" 
> class="industryModalClose" style="float: right;padding-right: 10px;"><img 
> src="/static/images/icon_modal_close.png" alt="close"/></a>Select 
> Function<span>Page 2 of 2</span></h2>
>
>
>                               <p class="heading">Please specify the function 
> of the <strong class="title"></strong> position by making a selection in 
> <em>all three boxes</em>.</p>
>
>
>                               <dl class="first" id="busiArea_list" 
> style="padding-left: 20px;">
>
>                                       <dt>Broad Area</dt>
>                                       <dd>
>                                               <ul>
>
>                                               </ul>
>                                       </dd>
>                               </dl>
>                               <dl id="funcArea_list">
>
>                                       <dt>Specific Area</dt>
>
>                                       <dd>
>                                               <ul>
>
>                                               </ul>
>                                       </dd>
>                               </dl>
>                               <dl id="specFunction_list">
>
>                                       <dt>Specific Function</dt>
>                                       <dd>
>
>                                               <ul>
>
>                                               </ul>
>                                       </dd>
>                               </dl>
>                               <div class="buttons" style="margin: 0px 0px 
> 10px;padding-left: 20px;width: 100%;">
>
>
>                                       <input type="image" 
> src="/static/images/btn_continueDisabled.png" alt="Save" height="39" 
> width="183" disabled id="finishModal">
>
>
>                                       <a href="#" class="goback" style="left: 
> 170px;top: -8px;">Cancel</a>
>
>
>                               </div>
>
>                       </div>
>                       <input type="hidden" name="key" 
> value="4e57f6bb8264ee1de0000000">
>
>
>               </form>
>       </div>
> </div>
>
>
>
>
> Thanks
>
>
>
> On Sun, Aug 28, 2011 at 1:39 AM, Jarmo <[email protected]> wrote:
>
>> It seems to me that you're trying to locate "li" inside wrong container.
>> Of course i can't see the whole html code, but at first you're checking that
>> the container exists like this:
>> ie.div.dl(:id, "container_dl").exists?
>>
>> And then you're doing like this:
>> ie.div.li(:id, "firstLink").exists?
>>
>> I'm not sure that the problem is in this line, but what if you'd try to do
>> something like this instead:
>> container = ie.div.dl(:id, "container_dl")
>> ie.wait_until {container.exists?} # or maybe use #present? instead of
>> #exists? to make sure that the container is also visible if it should be...
>>
>> container.li(:id, "firstLink").when_present.click
>>
>> If that line fails then try to access that li directly, since "id"
>> attribute *should* be unique within the page anyway:
>> ie.li(:id, "firstLink").when_present.click
>>
>> If that fails too then you have frames on the page or the li doesn't have
>> that id... use something like this for debugging:
>> puts ie.div(id, "industry").ul.html
>>
>> Sorry, can't help any more if you don't provide the whole html code and
>> your Watir code too.
>>
>> Jarmo
>>
>>
>> On Sat, Aug 27, 2011 at 6:10 PM, M <[email protected]> wrote:
>>
>>> Sorry to email you about this issue, I asked the question in Watir
>>> discussion group but with no help or replies at all.
>>>
>>> how do I select li link with id from a jquery dynamic list. Can this be
>>> done in watir??
>>> Using Watir 2.0, Ruby 1.8.7:
>>>
>>> require "rubygems"
>>> require "watir"
>>> require "firewatir"
>>> ie=Watir::IE.new
>>>
>>> I have a dynamic Div that contains
>>> <div id="industry" class="modal">
>>> <dl id="SomeID" class="first">
>>> <dt>someText</dt>
>>> <dd>
>>> <ul>
>>> <li id="someID1">
>>> <a href="#" class="selected">someText</a>
>>> <li id="someID2">
>>> <a href="#">SomeText</a>
>>>
>>> This list is in a modal "jquery pop up form". So I want to click on
>>> any <li>. and after I click on the link, another set of <li>'s will
>>> appear, that I need to select from as well. So my problem is how to
>>> select the li even though they are not in the page, because they are
>>> dynamically generated by the server based on the user click. Also do I
>>> need to wait for it to load. I am a Watir newbie so please the more
>>> detail the better.
>>>
>>> Here is my current code:
>>>
>>> #this will launch the jquery form successfully
>>> ie.link(:id, "launchIndustry").click_no_wait
>>>
>>> #this is the <dl> that contain all the <li>'s
>>> ie.wait_until {ie.div.dl(:id, "container_dl").exists? }
>>> puts ie.div.dl(:id, 'container_dl').exists? # good up to here
>>>
>>> ie.wait_until {ie.div.li(:id, "firstLink").exists? }
>>> ie.div(:id => "industry").li(:id => "firstLink").click
>>>
>>> The error that I get is:
>>>
>>> timed out after 60 seconds, which means that the script can't the
>>> first li element. Please help, because I have to select these options
>>> before I can move forward as it's a required field.
>>>
>>> Any help is appreciated.
>>>
>>> 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]

Reply via email to