|
List Info
Thread: Wait for control to exist
|
|
| Wait for control to exist |

|
2006-06-21 14:48:00 |
|
Hi all:
I
have issue relate to wait for control.
Earlier days I have posted [Wtr-general]
Problem with loading time on Java script driven html page
[link] http://rubyforge.org/pipermail/wtr-general/2006-May/005949.html
Thank you, Bret.
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?'
This is happen randomly at all object
when the page changes.
After I try to understand the reason,
I found the java script 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)
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 |
| Wait for control to exist |

|
2006-06-27 19:46:55 |
|
My comments below.
On 6/21/06, Jonathan Ni <ca.ibm.com">nijon ca.ibm.com> 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 java script 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
|
[1-2]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|