ruby watir to get html of a page

icn picture icn · Feb 15, 2012 · Viewed 10.9k times · Source

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

Željko Filipin picture Željko Filipin · Feb 16, 2012

This should do it:

puts browser.html