Chris Schmechel wrote:

>Hi,
>
>Is there a way in Watir to verify whether a page succesfully
>loaded from a HTTP perspective (ie. I got a 200 OK return
>code)?
>
>I'm executing ie.button().click method and I get redirected to
>an external page.  I need to validate that page loaded correctly.
>  
>
Use Net::HTTP class of Ruby to check the response by navigating to the page.

require 'net/http'
h = Net::HTTP.new('www.foo.com', 80)
resp, data = h.get('/index.html', nil )
puts "Code = #{resp.code}"
if #(resp.code) == 200
puts "The page has loaded"
else
puts "The page Error!!!"
end

>Thanks again!
>
>Chris Schmechel
>
>_______________________________________________
>Wtr-general mailing list
>[email protected]
>http://rubyforge.org/mailman/listinfo/wtr-general
>  
>


-- 
In most parts of the world they drive on the left of the road. In Bangalore we 
drive on what’s left of the road.


Sathya Shankar M G
Software Testing Engineer
Qantom Software
http://www.qantom.com
Ph : 26799269 Xtn. 123
sip : [EMAIL PROTECTED] 


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

Reply via email to