Otto Stolzenberger wrote:

> Is it possible to have my TCL script navigate a web site such as
> following links and entering data in text fields?  I've used TCL to talk
> to command line applications and remote servers.  Some our applications
> have web interfaces and I would love to be able to write a TCL
> application to test those out as well.  Is this possible?

       You could use the http library built into Tcl.  You can get the
documentation for that from the Tcl man pages.  It can
send a query to a web server and stores the response in an array variable.
Then you can manipulate the response in various
ways.   I tried it for a project I was doing - I did run into some trouble
when querying a site that tries to set a cookie - the server
would refuse to send the desired response because it detects that you are
using a "browser" that doesn't support cookies or javascript.

    Another way might be to use Tcl to control an external web browser program
such as the Unix version of Netscape or
lynx or you could use "wget" on Linux.  In my project, I  used Tcl to control
the "remote" functions the programmers of Netscape built into it
to sort of data-mine a medical web site for a set of drug interaction
monographs on a list of drugs I use in my medical office.
The Tcl script would send a query string to Netscape and it would then have
Netscape store the response in a temporary file  and
I could then scan that file using regular expressions to extract the parts I
wanted to store.  You can effectively follow links and enter data into text
fields by scanning the html file with regular expressions for the part
associated with the text box or link and then forming a query string to send
back to the server.  This works well as long as the pages are consistent in
format each time and you are getting say a large number of responses from a
server of the same type.  It might not work if you are navigating sites where
you have no idea what you are going to come across but I doubt if you'd be
using it that way.  Using the remote functions of Netscape also got around the
problem with
cookies because Netscape supports cookies and javascript.

   There is a web page at http://www.netscape.com/newsref/std/x-remote.html
that describes the "remote" functions of Netscape
that can be controlled from Tcl.

Alex Caldwell M.D.
[EMAIL PROTECTED]
Tk_familypractice http://www.psnw.com/~alcald/#informatics
begin:vcard 
n:Caldwell;Alexander
x-mozilla-html:FALSE
org:Tulare Family Practice
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
title:Physician
x-mozilla-cpt:;0
fn:Alexander Caldwell
end:vcard

Reply via email to