
25.08.2012, 15:12
|
 |
Профессионал
|
|
Регистрация: 06.08.2012
Адрес: Кривой Рог
Сообщения: 1,791
Версия Delphi: Delphi 7, XE2
Репутация: 4415
|
|
Цитата:
Сообщение от scroyler
Очень срочно, пожалуйста.
Вот код:
Код:
<button type="submit" class="input-button" style="width: 100%;"><b>Спросить</b></button>
как не пробовал,никак не получается
|
Примерно так (не проверял, но вроде должно работать):
Код:
procedure TForm1.Button1Click(Sender: TObject);
var
Collection: IHTMLElementCollection;
Element: IHTMLElement;
Button: IHTMLButtonElement;
i: Integer;
begin
Collection := WebBrowser1.Doc2.all.tags('BUTTON') as IHTMLElementCollection;
for i := 0 to Collection.length - 1 do
begin
Element := Collection.item(i, EmptyParam) as IHTMLElement;
Button := Element as IHTMLButtonElement;
if AnsiSameText(Button.type_, 'submit') and
AnsiSameText(Element.className, 'input-button') and
AnsiSameText(Trim(Element.innerText), 'Спросить') then
begin
Element.click;
Break;
end;
end;
end;
|