Ну вот, может чем-то поможет:
Код:
Нажатие на кнопку:
Код:
procedure PSpisokClick;
var HtmlDocument : IHtmlDocument2;
i : integer;
HtmlCollection : IHtmlElementCollection;
HtmlElement : IHtmlElement;
spisok : string;
begin
HtmlDocument := BrowserMain.Document as IHtmlDocument2;
HtmlCollection := HtmlDocument.All;
for i := 0 to HtmlCollection.length - 1 do
begin
if stop = 1 then Exit;
HtmlElement := HtmlCollection.Item(i, 1) as IHtmlElement;
spisok := HtmlElement.InnerText;
Trim(spisok);
if spisok = 'список' then
begin
HtmlElement.click;
Exit;
end;
end;
end;
выбор из открывающегося списка:
Код:
procedure SetFieldValue(theForm: IHTMLFormElement;
const fieldName, newValue: string; const instance: integer);
var
field: IHTMLElement;
inputField: IHTMLInputElement;
selectField: IHTMLSelectElement;
textField: IHTMLTextAreaElement;
begin
field := theForm.Item(fieldName,instance) as IHTMLElement;
if Assigned(field) then
begin
if field.tagName = 'INPUT' then
begin
inputField := field as IHTMLInputElement;
if (inputField.type_ <> 'radio') and
(inputField.type_ <> 'checkbox')
then
inputField.value := newValue
else
inputField.checked := (newValue = 'checked');
end
else if field.tagName = 'SELECT' then
begin
selectField := field as IHTMLSelectElement;
selectField.value := newValue;
end
else if field.tagName = 'TEXTAREA' then
begin
textField := field as IHTMLTextAreaElement;
textField.value := newValue;
end;
end;
end;
вызов процедуры:
Код:
theForm := GetFormByNumber(BrowserMain.Document as IHTMLDocument2,0);
SetFieldValue(theForm,'type',переменная);