Było już o tym (właśnie @ergo podał link) ale tam była prostsza sprawa bo nie było ramek wiadomo każdy iframe zawiera własne źródło a wiec własny dokument i trzeba przeszukać te dokumenty coś w stylu:
var
doc, doc2: IHTMLDocument2;
frames: IHTMLFramesCollection2;
window: IHTMLWindow2;
form: IHTMLFormElement;
elem: IHTMLElement;
dispatch: IDispatch;
i, j, k: Integer;
index: OleVariant;
begin
doc:= WebBrowser1.Document as IHTMLDocument2;
if Assigned(doc) then
begin
frames:= doc.frames as IHTMLFramesCollection2;
if Assigned(frames) then
begin
for i:= 0 to frames.length - 1 do
begin
index:= i;
dispatch:= frames.item(index);
dispatch.QueryInterface(HTMLWindow2, window);
if Assigned(window) then
begin
doc2:= window.document;
for j:= 0 to doc2.forms.length -1 do
begin
form:= doc2.forms.item(i, EmptyParam) as IHTMLFormElement;
for k:=0 to form.length - 1 do
begin
elem:= form.item(k, EmptyParam) as IHTMLElement;
if (elem.tagName = 'INPUT') and ((elem as IHTMLInputElement).name = 'plik') then
begin
elem.click;
exit;
end;
end;
end;
end;
end;
end;
end;
end;
Oczywiście w nowszych Delphi można by ten kod trochę skrócić ale w Delphi 7 nie ma zaimplementowanych wielu metod choćby GetElementByID. Jak masz nowsze Delphi to możesz sobie ten kod trochę zoptymalizować chodzi o to że musisz pobrać dokument z ramki i w nim dopiero szukać tego input.