5

I use Delphi 7 on Vista. So far, I have implemented a simple browser (using TWebBrowser) but I would like to automatically enter information when the web page asks for it. For example, I want to tell my app to go to Google, detect the Search field, enter a search phrase, and then click the Search button and then get the result.

Can someone shed some light on how this is done?

NGLN
  • 43,011
  • 8
  • 105
  • 200
  • 5
    You need to give some more data. You're using a TWebBrowser? You want to auto-fill edit boxes that appear on the web-page? It's better if you give an exact example (say, put some text in the page at google.com, and do a search etc). – Warren P Sep 03 '11 at 01:24
  • 3
    [Populating a webform](http://delphi.about.com/od/twebbrowser/a/submit_web_form.htm) – Whiler Sep 03 '11 at 06:56
  • 1
    Whiler-that looks like a reasonable answer - assuming Bill never updates his question... – Warren P Sep 04 '11 at 00:16

2 Answers2

4

You need to use the DOM to do this. The best online resource for learning this in a Delphi setting is at Brian Cryer's site. Take a look at How to read and write form elements.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
0

In the google instance you could simply call the search URL directly yourself.

Eg. This URL searches for 'jam'

http://www.google.ie/search?q=jam&ie=UTF-8&oe=UTF-8&hl=en&client=safari

Get your code to change jam for your search string and go to that URL. I hope this is what you are looking for.

Toby Allen
  • 10,997
  • 11
  • 73
  • 124