Код:
var
res,data, code1:Tstrings;
name,phone, code:string;
i,i1,i2,i3: Integer;
html: Variant;
DocS : IHTMLElementCollection;
Element: IHTMLElement;
a: variant;
begin
form1.WebBrowser1.Navigate('http://m.vk.com/');
while WebBrowser1.ReadyState<>READYSTATE_COMPLETE do Application.ProcessMessages;
begin
html := form1.WebBrowser1.OleObject.Document.forms.item(0).elements;
for i := 0 to (html.Length - 1) do
begin
if (html.item(i).name = 'email') then
html.item(i).value := form1.Edit2.Text;
if (html.item(i).name = 'pass') then
html.item(i).value := form1.Edit3.Text;
DocS:=(form1.WebBrowser1.Document as IHTMLDocument2).all.tags('input') as IHTMLElementCollection;
Element:=DocS.item(DocS.Length-1,0)as IHTMLElement;
Element.click;
end;
end;
begin
form1.WebBrowser1.Navigate('http://m.vk.com/login?act=blocked&change_phone#form');
while WebBrowser1.ReadyState<>READYSTATE_COMPLETE do Application.ProcessMessages;
form1.WebBrowser1.Navigate('http://m.vk.com/login?act=blocked¤t_phone#form');
DocS:=(WebBrowser1.Document as IHTMLDocument2).all.tags('input') as IHTMLElementCollection;
Element:=DocS.item(DocS.Length-1,0)as IHTMLElement;
Element.click;
end;
//... тут получаем код и вводим его в edit6.text;
html := WebBrowser1.OleObject.Document.forms.item(0).elements;
for i1 := 0 to (html.Length - 1) do
begin
if (html.item(i1).name = 'code') then
html.item(i1).value := edit6.Text;
DocS:=(WebBrowser1.Document as IHTMLDocument2).all.tags('input') as IHTMLElementCollection;
Element:=DocS.item(DocS.Length-1,0)as IHTMLElement;
Element.click;
end;
html := WebBrowser1.OleObject.Document.forms.item(0).elements;
for i2 := 0 to (html.Length - 1) do
begin
if (html.item(i2).name = 'pass') then
html.item(i2).value := form1.Edit1.Text;
DocS:=(WebBrowser1.Document as IHTMLDocument2).all.tags('input') as IHTMLElementCollection;
Element:=DocS.item(DocS.Length-1,0)as IHTMLElement;
Element.click;
end;
end;
При выполнении данного кода вылезают куча ошибок, как исправить? я так понимаю действия выполняются быстрее чем бразуер успевает прогружаться, искал на форумах что-то, но не особо нашел что-то