Delphi browses the Web page through Twebbrowser and then accesses the drop-down menu in the webpage:
Uses MsHtml;
procedureTform1.button1click (Sender:tobject);
var
Doc:ihtmldocument2;
Coll:ihtmlelementcollection;
IPos, Iindex:integer;
Selelem:ihtmlselectelement;
Optelem:ihtmloptionelement;
begin
Doc: = Webbrowser1.document as IHTMLDocument2;
If doc = nil then Exit;
COLL: = doc.all.tags (' select ') as IHTMLElementCollection;
IPos: = 0;The ordinal of the drop-down menu to access, starting with 0 for the first
Selelem: = Coll.item (IPos, 0) as ihtmlselectelement;
If Selelem = nil then Exit;
IIndex: = 2; //drop-down menu option number, starting from 0 for the first, 2 for the third option
Optelem: = Selelem.item (IIndex, 0) as IHTMLOptionElement;
If Optelem = nil then Exit;
ShowMessage (Optelem.text); //Gets the value of this option
optelem.selected: = True; //Select this option
end;
Delphi Access drop-down menu in Web page