Witam serdecznie
Chciałem zrobić program do automatycznego generowania tematów (nie mylić z botem do spamu).
Forum jest oparte na silniku IP.Board.
Korzystam przy tym z webbrowsera ale za nic nie mogę wypełnić formularza tego forum.
Próbowałem tak:
Uses
MSHTML;
[...]
var
dokumentwww : IHTMLDocument3;
elem: IHTMLElement;
doc : IHTMLDocument3;
begin
doc:= wb.Document as IHTMLDocument3;
elem:= doc.getElementsByName('Post').item(0, '') as IHTMLElement;
if Assigned(elem) then
(elem as IHTMLInputElement).value:= 'tresc tematu...';
oraz przez fillform
function FillForm(WebBrowser: TWebBrowser; FieldName: string; Value: string): Boolean;
var
i, j: Integer;
FormItem: Variant;
begin
Result := False;
if WebBrowser.OleObject.Document.all.tags('FORM').Length = 0 then
begin
Exit;
end;
for I := 0 to WebBrowser.OleObject.Document.forms.Length - 1 do
begin
FormItem := WebBrowser.OleObject.Document.forms.Item(I);
for j := 0 to FormItem.Length - 1 do
begin
try
if FormItem.Item(j).Name = FieldName then
begin
FormItem.Item(j).Value := Value;
Result := True;
end;
except
Exit;
end;
end;
end;
end;
if FillForm(WebBrowser, 'Post', 'tresc tematu...') = False then
ShowMessage('Wystąpił błąd');
Ale za nic nie idzie wypełnić tego formularza.
Proszę zatem Was o pomoc :)