ребята мой английский плохо, но мне нужна ваша помощь ...не может получить Элементы ... элементы веб-браузера. «A» и «Вход» Андо так далее ... DELPHI 2007
Я не могу получить кадры и элементы по одному WebBrowser, и Мне нужно получить все. «delphi 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;
Многие идеи ????? ожидание.
спасибо.
Мне нужно получить все входы, рамки, ссылки и т. Д., Есть идея, кто это делает. – user1213118
Проблема в том, что ваша реализация wbDocumentComplete неверна, она запускается несколько раз. – whosrdaddy
@whosrdaddy, извините, но откуда вы пришли, что 'wbDocumentComplete' запускается несколько раз? – TLama