ребята, у меня плохой английский, но мне нужна ваша помощь...
Я не могу получить кадры и элементы одним веб-браузером, и мне нужно получить все. "Дельфи 2007".
без этого приложения на моем компьютере я получаю все, но когда я устанавливаю это приложение, многие входы не назначаются. видеть...
public
doc1: IHTMLDocument2;
Elementos: IHTMLElementCollection;
Elemento: IHTMLElement;
end;
procedure TNavegador.wbDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
var
Z : Integer;
begin
doc1 := (pDisp as IWebBrowser2).Document as IHTMLDocument2;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo3.Text := Wb.OleObject.Document.documentElement.innerText; //not assigned
memo2.Text := doc1.body.innerHTML; // work. <-----
Elementos := (doc1.all).tags('A') as IHTMLElementCollection; //not assigned
if Assigned(Elementos) then
begin
for Z := 0 to Elementos1.length - 1 do
begin
Elemento := Elementos.Item(Z, 0) as IHTMLElement;
if Assigned(Elemento) then
begin
if pos('/IMG/bt_voltar.gif', Elemento.innerHTML) > 0 then
begin
Elemento.Click; //click in link back
end;
end;
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
Q : Integer;
Elementos1: IHTMLElementCollection;
Elemento1: IHTMLElement;
begin
Elementos1 := (doc1.all).tags('INPUT') as IHTMLElementCollection; //not assigned
for Q := 0 to Elementos1.length - 1 do
begin
Elemento1 := Elementos1.Item(Q, 0) as IHTMLElement;
if Assigned(Elemento1) then
begin
if Elemento1.getAttribute('name', 0) = 'Post_me' then
begin
Elemento1.setAttribute('value', '010203', 0);
end;
if Elemento1.getAttribute('name', 0) = 'btn_click' then
begin
Elemento1.Click;
end;
end;
end;
end;
function getAllInputs(doc: IHTMLDocument2): IHTMLElementCollection; //not assigned
var
elementos: IHTMLElementCollection;
begin
elementos := (doc.all).tags('input') as IHTMLElementCollection;
result := elementos;
end;
function getAllLinks(doc: IHTMLDocument2): IHTMLElementCollection; //not assigned
var
elementos: IHTMLElementCollection;
begin
elementos := (doc.all).tags('A') as IHTMLElementCollection;
result := elementos;
end;
Много идей??????? ждем.
Спасибо.
wbDocumentComplete
срабатывает несколько раз? - person TLama   schedule 16.02.2012