我正在使用此代码填写一些网页的领域,使用WebBrowser控件:我的代码无法找到场(德尔福 - 的Webbrowser)
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;
但“的SetValue”方法不能填写领域为此网页! : http://commenting.iranblog.com/services/commenting/commenting.aspx?BlogID=67436&PostID=754352
SetValue(W.document as IHTMLDocument2, 0, 'name', 'ThisIsANewValueForField');
事实上,我认为这个网页的验证码无法找到字段名,但我不知道原因!
发生了什么或没有发生什么? – 2010-08-19 15:53:28
有趣的缩进... – 2010-08-19 16:14:01