From: michael Date: 2006-08-09T08:25:05+09:00 Subject: Re: downloading web pages in watir thanks.. body is all I want.. okay.. let's suppose i would like to download 'www.yahoo.com', and save it as c:\yahoo\yahoo.htm would you show me how I can realize this in ruby, watir?? thank you so much.. michael Brian Cowdery wrote: > michael wrote: > > could anybody tell me how to download web pages accessed through > > watir?? > > > > thanks > > > > michael > > While there isn't any methods in Watir to directly download a webpage to > a file, you can get the HTML content yourself and do your own file > writing. > > for example; > > ie = Watir::IE.new > ie.goto('www.google.ca') > > File.open('google.html', "wb") { |f| > f << '' > f << ie.html > f << '' > } > > Note that the Watir.ie.html method returns the document.body, which does > not include the opening and closing tags - so you'll need to > include them in the file writing block. > > -- > Posted via http://www.ruby-forum.com/.