Hi , i'm using this code to fill out fields of some WebPages , using WebBrowser control :
procedure TFrmMain.SetValue(const document: IHTMLDocument2;
const formNumber: Integer;
const fieldName, newValue: string);
var
form: IHTMLFormElement;
field: IHTMLElement;
begin
form := WebFormGet(formNumber, document);
field := form.item(fieldName, '') as IHTMLElement;
if field = nil then
exit;
if field.tagName = 'INPUT' then (field as IHTMLInputElement)
.value := newValue
else if field.tagName = 'SELECT' then (field as IHTMLSelectElement)
.value := newValue
else if field.tagName = 'TEXTAREA' then (field as IHTMLTextAreaElement)
.value := newValue;
end;
But "SetValue" method can not fill out fields for this WebPage !!! : http://commenting.iranblog.com/services/commenting/commenting.aspx?BlogID=67436&PostID=754352
SetValue(W.document as IHTMLDocument2, 0, 'name', 'ThisIsANewValueForField');
In fact, i think this code can not find the field name for this WebPage but i don't know the reason !