Displaying 20 results from an estimated 1000 matches similar to: "Mechanize#get vs Mechanize#fetch_page"
2008 Jan 16
3
settings headers in mechanize
hi,
a potential mechanize user here. i''ve looked at the API but it''s not
clear what capacity there is to arbitrarily set the headers - does
mechanize allow for this?
mechanize is clearly great for web browsing, but i also need to
construct get and post requests from scratch. i''ve looked at
net:http, libcurl, openuri, but mechanize seems simpler and more
functional than
2006 Sep 26
7
Interesting mechanize difficulty
I found an interesting page today that I was trying to script
against. The server returns a 404 with content and the page just
works normally in firefox despite the 404. Mechanize raises an
exception on it though.
I''m working on a test case now.
2010 Jun 10
2
submit button param is duplicated when a form is submitted a second time
Hello,
Below I''ve pasted a simple example to reproduce what I say in the
subject. I wonder...
Is it a bug? Is there any workaround?
Thanks!
require ''rubygems''
require ''mechanize''
agent = Mechanize.new
page = agent.get(''http://google.com/'')
google_form = page.form(''f'')
google_form.q = ''ruby
2010 Sep 01
4
NoMethodError: undefined method `force_encoding' for "Conten
Hi everyone!
Im trying to install mechanizer from
http://github.com/tenderlove/mechanize.
I`ve clone the project into /tmp folder. When I do rake inside the
folder /tmp/mechanizer it gives me this error:
mac159180:mechanize renatosis$ rake
(in /private/tmp/mechanize)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -w
-Ilib:bin:test:. -e ''require "rubygems";
2006 Nov 02
5
Adding fields to a form
Is there a decent way to add a field to a form before posting it? I
haven''t tried using HPricot manipulations just yet, since I can''t
ever find really solid docs on hpricot....
Form#[]= doesn''t work because it first searches only pre-existing
fields. I''m investigating how to write a patch now.
But I thought maybe someone here might have an idea.
2008 Mar 10
2
Mechanize for multi-part form post
Hi,
I''m interested in using Mechanize as a way around manual multipart
form creation. But the API is really centered around the idea of a
form built from a page. I''d love to see a syntax like:
response = agent.post(''http://www.mydomain.com/upload'',
:image => File.new(file),
:title => "My image",
:description => "an image
2007 Jul 02
6
Basic auth bug in 0.6.9
I haven''t spent the time to get a proper test case for this yet, but
there appears to be a bug in the basic_auth code for mechanize
0.6.9. I''ve attached a CSV (from Charles) that illustrates the problem.
Basically when running with basic_auth, there''s a failed request
that''s followed up by a successful request. That last POST is a
agent.submit(form)
2010 Jun 03
3
issue submitting a form
Hi. Recently I started rebuilding my old Mechanize script, which I
used to automatically log in to a certain site and retrieve files from
it. Old version worked great, however, when I did the update it
started complaining. Here''s the log of the error:
/Users/lukastolyarov/.gem/ruby/1.8/gems/mechanize-1.0.0/lib/mechanize/form/field.rb:30:in
`<=>'': undefined method
2007 Jul 24
3
Jruby + Rhino = Javascript support?
Hey Aaron, I''m just thinking out loud here, but have you considered
the possibility of using the Rhino [1] library to implement
javascript support in mechanize? It''d create a jruby dependency for
that feature, but still. Just thought I''d bring it up while I was
thinking about it.
-Mat
[1] http://www.mozilla.org/rhino/
2009 Jun 25
2
Bad Form?
Hi,
This is my first post, I wanted to ask a quick question about "Bad Form" --
rather, am I doing something with Mechanise I shouldn''t be doing?
Here''s the long and short of it - I am using Mechanize with Cucumber and
RSpec to test a *ahem* Perl XML web service.. talk about technology soup,
but I have it working quite well.
I have an example project on GitHub that
2006 Sep 18
2
BUG: Possible issue with escaped hrefs
I noticed an interesting problem today when scripting against a web
app. The application contained a link in it that used %20 instead of
spaces. After running mechanize through the Charles debugging proxy
I found that mechanize was converting %20 to %2520 (double escaping
the %20).
This appears to happen under both 0.5.4 and 0.6.0.
Here''s a simple set of files that demonstrate
2007 Mar 25
5
mechanize 0.6.6 Released
mechanize version 0.6.6 has been released!
http://mechanize.rubyforge.org/
The Mechanize library is used for automating interaction with websites.
Mechanize automatically stores and sends cookies, follows redirects,
can follow links, and submit forms. Form fields can be populated and
submitted. Mechanize also keeps track of the sites that you have visited as
a history.
Changes:
=
2008 Mar 15
4
[PATCH] Get requests with non-html referers
Hey, Aaron. Looks like that get with hash params patch you checked in
had some side effects. Specifically, you''re testing if a referer is a
Page (mechanize.rb:171), but the referer could also be a
WWW::Mechanize::File. Like if the last page loaded was xml. Here''s a
patch that addresses the issue.
Thanks again,
Mat
-------------- next part --------------
A non-text
2007 Jan 27
7
Getting elements from a web page
I am new to Mechanize and was wondering if there was a built-in method
to get the elements that are on the page that are not part of a form.
A couple of examples would be my banking site lists my entries and I
want them to go into an array so that I can handle them.
Or another site I use, does some categorization for me and I would like
to manipulate it and present it differently to a user.
2009 May 05
3
Only partially reading a page!
I am trying to get a page which includes a form, but the form is
missing from the WWW::Mechanize::Page object. I retrieve it via:
page = web_agent.submit(a_different_form)
For debugging this problem, I then immediately write the resulting
page to two different logs:
File.open(''big.html'',''wb'') { |f| f.write(page.body) }
2008 Apr 29
6
Intercepting an onClick file download
Hi,
I''m having some trouble downloading a .csv file from a particular
website. The file isn''t part of a url, you need to click on a link in
order to get the file sent. I don''t know how to get mechanize to
correctly identify that.
Here is the link to the file I''m trying to retrieve:
<td style="vertical-align: bottom; text-align: center;">
2007 Feb 07
15
https with certificates
I poked around the web a little and didn''t run across how to use https
when it asks for certificate validation.
I''m trying to connect to devices that don''t have valid certificates,
and in this case, I don''t care if they are or not.
So when I use my browser to ge to the site, firefox asks me to allow
the certificate, then one other question, then I get the
2007 Jul 15
3
rejected form not handled
Hello,
I have a login form on /login.php which POSTs to /dorf1.php when access is
granted and to /login.php when it is denied.
require ''rubygems''
require ''mechanize''
agent = WWW:Mechanize.new()
login = agent.get("http://server/login.php")
form = login.forms.action("dorf1.php")
form.fields[2].value = "wronguser" # login
2007 Jul 23
4
Design ideas
I''m trying to use mechanize against a site that has four fields in the
form. However, those four fields have to be filled in order.
So putting something in field one, populates the second field drop down.
So I''m thinking that I''ll probably have to call the page multiple times?
What sort of things should I be doing to figure out how to interact
with this page.
2007 Nov 12
3
Weird error downloading a gzip''ed file
Hi all,
I''ve been using mechanize for a while and it rocks. Docs are pretty clear
and so far I''ve been able to do it on my own.
However, I''m stuck in a weird situation in a script to download my contact
list from hotmail.
I''ve used Firebug to check all urls, and tested it by hand while logged in
via browser.
Even in the script everything works well until the