icn icn - 6 months ago 31
Ruby Question

ruby watir to get html of a page

I have looked through the examples on these pages

http://watir.com/examples/
http://wiki.openqa.org/display/WTR/Examples

I still don't see a simple example of getting html of a page.

browser = Watir::Browser.new
browser.goto 'mysite.com'


I have tried

puts browser.text


It seems not working.

Thanks

Answer

This should do it:

puts browser.html