[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

READYSTATE_COMPLETE = 4

Jerry Lane

6/4/2009 9:05:00 AM

I am trying to use this but not sure how to implement it. I just want to
check after x seconds if page is loading so was trying something like:

sleep (10)

pageCheck = READYSTATE_COMPLETE = 4

if pageCheck = true
puts 'test passed'
else
puts 'epic fail'
end

Any ideas where I am going disasterously wrong?
--
Posted via http://www.ruby-....

3 Answers

Justin Collins

6/4/2009 9:42:00 AM

0

Jerry Lane wrote:
> I am trying to use this but not sure how to implement it. I just want to
> check after x seconds if page is loading so was trying something like:
>
> sleep (10)
>
> pageCheck = READYSTATE_COMPLETE = 4
>
> if pageCheck = true
> puts 'test passed'
> else
> puts 'epic fail'
> end
>
> Any ideas where I am going disasterously wrong?
>

'=' is for assignment, '==' is for comparison.

sleep (10)

pageCheck = READYSTATE_COMPLETE = 4 # This sets pageCheck and READYSTATE_COMPLETE to 4

if pageCheck = true # This sets pageCheck to true
puts 'test passed'
else
puts 'epic fail'
end


It's hard to tell exactly what you are trying to do, but I _think_ you
want something more like

if READYSTATE_COMPLETE == 4
puts 'test passed'
else
puts 'epic fail'
end


or if you need pageCheck later

pageCheck = READYSTATE_COMPLETE == 4

if pageCheck
puts 'test passed'
else
puts 'epic fail'
end


-Justin

Jerry Lane

6/4/2009 10:17:00 AM

0

when I try this I get the following:

test_00009_Bug4986_error_on_dialog_close(DocumentTestScripts):
NameError: uninitialized constant
DocumentTestScripts::READYSTATE_COMPLETE
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:105:in
`const_missing'
test_Bug4986.rb:42:in `test_00009_Bug4986_error_on_dialog_close'


It is actually a type of Watir test I am trying to run which checks if
the page displays done (as in fully loaded) in the bar on the bottom of
the window but I cant get it to work :(
--
Posted via http://www.ruby-....

Justin Collins

6/4/2009 10:48:00 AM

0

Jerry Lane wrote:
> when I try this I get the following:
>
> test_00009_Bug4986_error_on_dialog_close(DocumentTestScripts):
> NameError: uninitialized constant
> DocumentTestScripts::READYSTATE_COMPLETE
> c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:105:in
> `const_missing'
> test_Bug4986.rb:42:in `test_00009_Bug4986_error_on_dialog_close'
>
>
> It is actually a type of Watir test I am trying to run which checks if
> the page displays done (as in fully loaded) in the bar on the bottom of
> the window but I cant get it to work :(
>

You might want to ask on the Watir mailing list, then:
http://groups.google.com/group/watir-gen...

But the previous code is not going to work - you need to get the
readyState from the Watir::IE object and compare that to
READYSTATE_COMPLETE (which is 4): http://wtr.rubyforge...


-Justin