Filling in a web page with Delphi using TWebBrowser
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 thi开发者_StackOverflows is done?
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.
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.
精彩评论