Цитата:
Сообщение от Sharky
Добрый вечер народ. У меня тут такое дело : есть станица с адресом икс на этой интернет странице есть 2 эдита мне нужно программно вбить туда символы и сделать запрос то есть нажать на кнопку которая есть на станице. Буду рад за любые подсказки.
|
Нажать на кнопку, заполнив перед этим поля логина и пороля можно так:
Код:
var
i: integer;
ov: OleVariant;
iDisp: IDispatch;
iEl: IHTMLElement;
iDoc:IHtmlDocument2;
login_al,pwd_al: string;
iColl: IHTMLElementCollection;
iInputElement: IHTMLInputElement;
begin
if WebBrowser1.Document=nil
then Exit;
WebBrowser1.ControlInterface.Document.QueryInterface(IHtmlDocument2,iDoc);
if not Assigned(iDoc)
then
begin
ShowMessage('Nothing dowloaded ...');
Exit;
end;
ov:='INPUT';
IDisp:=iDoc.All.Tags(ov);
//
if Assigned(IDisp)
then
begin
IDisp.QueryInterface(IHTMLElementCollection,iColl);
if Assigned(iColl)
then
begin
for i:=1 to iColl.Get_Length do
begin
iDisp:=iColl.Item(pred(i),0);
iDisp.QueryInterface(IHTMLInputElement,iInputElement);
if Assigned(iInputElement)
then
begin
if iInputElement.Get_Name=login_al
then iInputElement.Set_Value(ComboBox2.Text);
if iInputElement.Get_Name=pwd_al
then iInputElement.Set_Value(ComboBox3.Text);
if iInputElement.type_='submit'
then
begin
iInputElement.QueryInterface(IHtmlElement,iEl);
iEl.click;
end;
end;
end;
end;
end;
end;