Re: Auto Fill Web Forms



"Zathras" <webnewsgroup@xxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:dhqi6157fh9da3hpk8ausb8ak4hngnm0lf@xxxxxxxxxx

> I've spent days on the net (Google/MSDN etc) trying to find a way to
> fill in web forms from my Delphi application. I don't want to buy
> ready-made code or an existing application as I want to learn how to
> do this myself.

Read the HTML 4.01 spec at w3.org. Chapter 17 is about forms.


> Basically I want my Delphi app to open a browser window (via
> ShellExecute?) and automatically fill in a form or pop-up form that
> the browser displays.

Brr. You most definitely don't want to do that.


> I guess the tasks are to
>
> 1/ Find the topmost window of the application my app starts
> 2/ Enumerate all the controls

Parse the HTML document into an element tree and find all the INPUT
elements within the FORM elements. Using an existing HTML parser is
good for this, but displaying it in a window is an unnecessary step.


> 3/ Fill in the appropriate controls

This too is an unnecessary step. Submitting the form results in an
HTTP request being sent to a web server... unless JavaScript is used
to do something else. It often is, and no punishment can be harsh
enough for the Webmeister types who've convinced themselves they can't
do without it.

I haven't looked but chapter 17 may detail how form submissions are
done, too. If it doesn't, read the HTTP (1.0) spec about parameters
with GET requests, and with POST requests. The effect is the same
but the intention was once different, and the mechanism still is.

Once you know what the form looks like, you can construct the right
HTTP request to "submit" it. No browser required.

Windows, incidentally, has nothing to do with this.

Groetjes,
Maarten Wiltink


.



Relevant Pages

  • Re: Borland, how much for purchasing rights to develop a 64bits Delphiversion?
    ... really unnecessary to port Delphi to .NET. ... Longhorn and its satellite tools won't be here until circa 2007. ... market window"), then there timing was sadly off by quite a few years. ...
    (borland.public.delphi.non-technical)
  • Re: Delphi control IDs
    ... failing miserably to correctly identify the Delphi program's focus ... I do have a handle to the window. ... that a service can't do this directly and that explorer is the program ... "context" of a control in a Delphi program. ...
    (alt.comp.lang.borland-delphi)
  • Re: Alphablending
    ... Since its such a small work in Delphi, this cant be asking to much? ... You're *not* building the window in assembly here, ... And at the end of the day, I'd just use the Delphi form designer anyway. ... Does your window frame "theme" ...
    (alt.lang.asm)
  • Re: Note to AlanGLLoyd and Maarten Wiltink
    ... > I decided to do it that way because my main Window (i.e. frmStartUp) ... destroying its Delphi object when the form is closed. ... cue, hiding them on close, and destroying them on shutdown. ...
    (alt.comp.lang.borland-delphi)