[Wylug-help] Fw: Automate Web logins

Smylers Smylers at stripey.com
Tue Jun 29 19:35:27 BST 2004


Idris Fulat writes:

> PS.. just out of interest my VB code opens IE 'looks' for the login
> and password fields, fills them in and then submits and then closes IE
> (its like a background task without actually showing the IE window so
> the user continues with their IE session).

Oh, wow.  (And I don't mean that in the good way ...)

> The linux alternatives seem awfully complicated from my point of view.

Which just shows that people have different viewpoints!  On reading your
description of how it works in Windows I couldn't believe how
complicated _that_ was.

My way of thinking about it is that so far as the web-server is
concerned, the process of logging in involves receiving a single HTTP
request.  Therefore what we want is a script that sends a single HTTP
request, and anything else is overkill.

> Is it not possible for 'something' to call mozilla 'look' for the
> fields and fill and submit.

It quite possibly would be, but that involves doing so much more than
simply sending an HTTP request that it becomes much more fraught; there
are more places where it can go wrong.

It would require a graphical display for the user it's running as, which
requires them to be logged in somewhere.  If that user logs out (perhaps
they want to change their X settings, or they've just bought a new mouse
or something) then the task won't run.

But automated tasks don't usually involve graphical interfaces; guis
were created to make it easier for humans to interact with computers,
and it doesn't really make sense to force an automated task have to use
a gui.  The task doesn't need any kind of graphical output or display,
so including them is superfluous and adding to the list of things that
can go wrong.

So automated tasks on Unix-like systems tend to be specified in terms of
non-graphical commands.  That's one of the best features of Unix, that
the canonical form of most commands is command-line based, and the
various graphical interfaces are just front-ends which call command-line
equivalents underneath; so for very many tasks which you can point-and-
click, you can also script them straightforwardly.

> but I really thought it would have been a much simpler process. I've
> attached the VB code if you're interested.

Having looked at your VB code, the Perl code using WWW::Mechanize would
be very similar -- everything would be spelt differently and there'd be
more punctuation marks of course, but the complexity and number of
tokens would be about the same.

The only difference is that in VB you're driving a gui app with a
script, and in Perl you're using a library that was specifically
designed for being scripted.  (And if you use HTTP::Recorder then you
don't even have to do the scripting yourself.)

Smylers





More information about the Wylug-help mailing list