I know there’s Watir or something… but I’m not using
IE (rather Firefox) and I don’t want to “control the
browser” per se…
Rather I want to automate some repetitive tasks… like
go to a form, fill in a couple of fields, click a checkbox,
pick from a dropdown, and click on Save.
Rather I want to automate some repetitive tasks… like
go to a form, fill in a couple of fields, click a checkbox,
pick from a dropdown, and click on Save.
How would you do this?
If it doesn’t involve javascript, mechanize should do just fine.
I know there’s Watir or something… but I’m not using
IE (rather Firefox) and I don’t want to “control the
browser” per se…
Rather I want to automate some repetitive tasks… like
go to a form, fill in a couple of fields, click a checkbox,
pick from a dropdown, and click on Save.
I know there’s Watir or something… but I’m not using
IE (rather Firefox) and I don’t want to “control the
browser” per se…
Rather I want to automate some repetitive tasks… like
go to a form, fill in a couple of fields, click a checkbox,
pick from a dropdown, and click on Save.
How would you do this?
If I were going to do it in a browser, I’d use Selenium RC [1] along
with
the included selenium.rb to do things like this:
No, I don’t have to do it via FF or any other browser.
Can curl do that sort of thing? I’ve never used it
except for simple sucking-down of pages.
Yes.
-F/–form <name=content>
(HTTP) This lets curl emulate a filled in form in which a user has
pressed the submit button. This causes curl to POST data using the
content-type multipart/form-data according to RFC1867. This enables
uploading of binary files etc. To force the content part to be be a
file, prefix the file name with an @ sign. To just get the content part
from a file, prefix the file name with the letter <. The difference
between @ and < is then that @ makes a file get attached in the post as
a file upload, while the < makes a text field and just get the contents
for that text field from a file.
Example, to send your password file to the server, where password is
the name of the form-field to which /etc/passwd will be the input:
Don’t forget about DHTML. Without a browser you will have to write your
own browser engine to process java script. For the simple forms without
html you can use TCP to get and send HTML requests.
I know there’s Watir or something… but I’m not using
IE (rather Firefox) and I don’t want to “control the
browser” per se…
Rather I want to automate some repetitive tasks… like
go to a form, fill in a couple of fields, click a checkbox,
pick from a dropdown, and click on Save.
Some of this info may be obsolete now. Forms are more difficult
and depend on the server you use. Agora cannot do this, unless
someone’s version has been improved. Getweb could do forms when I
last looked some years back. I don’t know which getweb servers are
still running.
I worked on something very similar recently. We looked at Beautiful
Soup, Rubyful Soup, and Mechanize, and went with Mechanize in the end.
I think Beautiful Soup is actually better, but it’s in Python. For me
that was a minus, and for the other programmer on the project, it was
a deal-breaker. Rubyful Soup is a direct port of Beautiful Soup which
is literally ten times slower. Mechanize has performance equivalent to
Beautiful Soup and is pretty easy to use as well. I think some of the
underlying code comes from why the lucky stiff. That’s generally
considered a good thing.