Displaying 9 results from an estimated 9 matches for "save_as".
Did you mean:
slave_as
2007 Jul 13
2
How do you handle pop ups?
When I click a link to download a file, a pop up window comes up to save the
file. Is there a way to enter a file name and click the submit button with
mechanize?
Thanks,
Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mechanize-users/attachments/20070712/558f7018/attachment.html
2007 Mar 18
1
Submitting a form sends a file. How do I save it?
...he first time i''m having to use forms (scraping
previously). So, after i fill out the form, when I hit submit, it
sends me information in the form of a text file to download. For the
life of me, I can''t see how to get access to it. When clicking on a
link, you can put a save_as on it and save the data as a file.
How do I save off data that''s sent to me via the submit of a form?
Thanks for any advice,
Will
2007 Apr 03
2
Scraping and saving.
Hi,
I''m working to scrape and save some ebooks. Mechanize has been
wonderful so far. The link I''m having trouble with is this one.
http://www.webscription.net/SendZip.aspx?SKU=0671578499&ProductID=379&format=H
When I click that in the browser it saves it to a file named
H_1632.zip. How do I get that name from the page. I suspect to save
this to a file I would just do
2007 Apr 16
7
pdf-file tot desktop with pdf/writer problem
Hi,
I''m using pdf/Writer to generate a pdf-file, but whatever I do, it
gets saved in folder of my app, and not on the users desktop.
I''ve used
pdf = PDF::Writer.new
pdf.select_font "Times-Roman"
pdf.text "Hello.pdf", :font_size => 12, :justification
=> :left
File.open("hello.pdf", "wb") { |f|
2008 Apr 29
6
Intercepting an onClick file download
...e.new { |a| a.log = Logger.new("mech.log") }
agent.keep_alive = false
agent.read_timeout = 60 # the page would timeout sometimes
url = "https://website.com/page.php4"
page = agent.get(url)
page.links.text(/Export to CVS/).each { |link|
file_page = agent.click(link)
file_page.save_as(''output.csv'')
return
}
What I get in output.csv is just the original page, not the .csv file.
If someone could please help me understand how I can nab the file
contents instead, I''d greatly appreciate it. (I actually want to
eventually parse the csv within the code,...
2009 Mar 11
0
problem scrapping ATnT site (Matt White)
...# click on the csv radio button
>
> download_format_form = page_download.forms[3]
> download_format_form.radiobuttons[1].click
>
> # click on the submit link that downloads the csv file.
>
> download_file = agent.click download_page.search("a")[41]
> download_file.save_as("<path_to_file>.csv")
>
> The problem I am facing in the above code is:
>
> + Doesn''t do anything special after selecting a particular bill period from
> the select options.
> + Download the page source in stead of downloading the actual csv file.
>
>...
2007 Aug 21
7
Signin to LinkedIn
Hi,
Does anyone have the formula for getting logged into LinkedIn?
Here''s my current attempt:
require ''rubygems''
require ''mechanize''
agent = WWW::Mechanize.new
home_page = agent.get(''http://www.linkedin.com'')
signin_page = agent.click home_page.links.text(''Sign in'')
puts "\nSIGNIN PAGE"
2006 Jun 13
2
Top margin on PDF generated with PDF::Writer
...d_text_wrap(0, pdf.y, PDF::Writer.cm2pts(1), "Test1", 12, :left, 0)
#pdf.add_text_wrap(PDF::Writer.cm2pts(8.5), pdf.y,
PDF::Writer.cm2pts(6), "Test2", 12, :center, 90)
pdf.restore_state
pdf.close_object
pdf.add_object(card, :this_page)
end
end
pdf.save_as("public/pdf/cupones.pdf")
end
But the generated pdf has a top margin of 36pt, and the cards are then
printed in two pages. I need a margin of 0 for the page, to ensure
that all that cards are printed at the same page.
Also, a couple of cards are printed one on top of the other partially...
2007 Nov 12
3
Weird error downloading a gzip''ed file
...baseURL=pageContact.uri.host
contactURL=''http://''+baseURL+''/mail/GetContacts.aspx''
p contactURL
page = agent.get_file(contactURL)
p page
if (page.code == ''200'')
puts "saving contacts.csv"
page.save_as(''contacts_msn.csv'')
else
puts "error downloading contacts"
end
rescue
puts "Err: "+$!
puts "Trace:"
$@.each {|tl|
puts tl
}
end
--
More cowbell, please !
-------------- next part --------------
An HTML att...