[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Best way to automate web browser tasks?

Hal E. Fulton

10/25/2006 1:00:00 AM

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?


Hal

12 Answers

Eero Saynatkari

10/25/2006 1:25:00 AM

0

On 2006.10.25 10:00, Hal Fulton wrote:
> 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?

WWW::Mechanize should be able to do it.

Gregory Brown

10/25/2006 1:25:00 AM

0

On 10/24/06, Hal Fulton <hal9000@hypermetrics.com> wrote:

> 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.

Ezra Zygmuntowicz

10/25/2006 1:31:00 AM

0


On Oct 24, 2006, at 6:00 PM, Hal Fulton wrote:

> 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?
>
>
> Hal
>

WWW::Mechanize[1] is pretty cool for stuff like this. There also
exists SafariWatir and FireWatir for safari and firefox respectively.
But firewatir is 20 times slower then normal watir at the moment.

[1] http://rubyforge.org/forum/forum.php?for...

-- Ezra Zygmuntowicz
-- Lead Rails Evangelist
-- ez@engineyard.com
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)



Ara.T.Howard

10/25/2006 1:41:00 AM

0

Hal E. Fulton

10/25/2006 3:52:00 AM

0

ara.t.howard@noaa.gov wrote:
>
> curl?
>
> seriously - do you have to do it via firefox?
>

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.


Hal


Philip Hallstrom

10/25/2006 4:03:00 AM

0

Hal E. Fulton

10/25/2006 4:21:00 AM

0

Philip Hallstrom wrote:
>>> curl?
>>>
>>> seriously - do you have to do it via firefox?
>>>
>>
>> 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>

[snip snip]

Doing a 'man curl' I see now that it has a plethora of options --
someone once said, a metric sh*tload.

It looks a little painful, though. I suppose for a dropdown you'd
have to type the full value of the selected option? Or am I thinking
of a checkbox?

I see now that this thing has a lot of Javascript in it. When I hover
over the New button, it says:

javascript:hideMainMenu();submitbutton('new');

which just complicates things that much more.

What about Mechanize? Better/worse/different?


Thanks,
Hal




>
> (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:
>
> curl -F password=@/etc/passwd www.mypasswords.com
>
> To read the files content from stdin insted of a file, use
> - where the file name shouldve been. This goes for both @ and <
> constructs.
>
> You can also tell curl what Content-Type to use for the file upload
> part, by using type=, in a manner similar to:
>
> curl -F "web=@index.html;type=text/html" url.com
>
> See further examples and details in the MANUAL.
>
> This option can be used multiple times.
>
>


Ara.T.Howard

10/25/2006 4:48:00 AM

0

Hugh Sasse

10/25/2006 10:48:00 AM

0

(Alex Furman)

10/25/2006 11:36:00 AM

0

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.

Alex
http://webunitt...


Hal Fulton wrote:
> 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?
>
>
> Hal