Hallo,
ich versuche gerade eine Selectbox auszulesen, ohne den Webbrowser zu benutzen. Das Problem ist, dass die Selectbox beim Laden befüllt wird. Sie sieht folgendermaßen aus:
HTML-Dokument
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17:
| <body class="nav" onload="OnLoad(document.forms[0]);"> <td align="left" class="tabelle"> <span class="selection"> <nobr> Element<br> <span class="absatz"> <br> </span> <select name="element" class="selectbox"> <option value="1"> ?????.gif </option> </select> </nobr> </span> </td> </body> |
So hab ich versucht sie auszulesen
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33:
| function TVPlanParser.GetSelectbox(aDoc: IHTMLDocument2): boolean;var Disp: IDispatch; SelEl: IHTMLSelectElement; i: Integer; OptionEl: IHTMLOptionElement; option_ids: array of WideString; option_texts: array of WideString; begin Disp:=(aDoc as IHTMLDocument2).all.item('element', EmptyParam);
(Disp as IHTMLElement2).focus;
if Assigned(Disp) and Supports(Disp, IHTMLSelectElement, SelEl) then begin SetLength(option_ids, SelEl.length); SetLength(option_texts, SelEl.length); for i:=0 to SelEl.length-1 do begin OptionEl := SelEl.Item(i,EmptyParam) as IHTMLOptionElement; showmessage(OptionEl.Value); option_ids[i] := OptionEl.Value; option_texts[i] := OptionEl.Text; end; end; end; |
(
stackoverflow.com/qu...rowser-into-an-array)
Damit bekomm ich aber nur den Wert "1", der von anfang an drin steht. Also wurde die OnLoad Funktion nicht aufgerufen
Hat jemand eine Ahnung wie ich an die andern Werte komm?
Viele Grüße
Littleben