My comments below.

On 6/21/06, Jonathan Ni <[EMAIL PROTECTED]> wrote:
I have tried to implement this wait_until function on my own. My code handles some situation, however the most case I got an error that I don't really understand.
Error message:
NoMethodError: undefined method `all' for nil:NilClass
    C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1029/./watir.rb:984:in `ole_inner_elements'
    C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1029/./watir.rb:1033:in `locate_input_element'
    C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1029/./watir.rb:3448:in `locate'
    C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1029/./watir.rb:2398:in `exists?'

Without even looking at the code, let me explain what this message itself means. We have some code that looks like "something.all" and the something is actually nil.

Now i know that ole_inner_elements is usually implemented as document.body.all -- so that would mean that the "body" is nil. 

This is happen randomly at all object when the page changes.
After I try to understand the reason, I found the _javascript_ rendering data has following steps.
1. load object
2. load more attributes of this object
3. load more data that this object needs. (eg. select box options)

I think that you need to first call ie.wait -- this will wait for the page load, which will ensure that you have a body. If you need additional waiting after that, then use your code for that.
 
My code
1.upto timeout do
  result = object(:text_field,:name,/logonId/)
  if result &&  result.respond_to?('exists?') && result.exists?
        return result
  else
    sleep 1
  end
end

The error is happens at result.exists?
I think this is because object(:text_field,:name,/logonId/) is return the result at (1) stage, which is load object.
What this mean is the text_field tag is already been loaded, but not completely.
So when the result.exists, it goes to @o = @container.locate_input_element(@how , @what, self.class::INPUT_TYPES)

From here, I am lost.

Could someone help me with this?
Maybe my finding about _javascript_ loading object is not right.

Please help me! Thanks everyone.

Regards,
Jonathan Ni
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to