0

I am trying to automatically submit a form, and save the resulting image that gets shown in the TWebBrowser object.

The image gets loaded over several chained javascript requests (ajax), until it finally appears in the document.

What is the best way to get this image? I thought of hooking the receive function to be able to see the http response (which would basically be my image).

Another possibility could be to load the image from cache / memory...

I don't have any idea how to practically do this, I hope someone can help.

Thanks.

4

3 に答える 3

1

アプリケーションのスケーラビリティを高めるには、 EmbeddedWBを直接試すことができます。IWebBrowser2 をラップし、非常に使いやすいです。Embarcadero は、RADStudio で EmbeddedWB を使用しています。

于 2010-09-02T00:53:10.660 に答える
1

IHTMLDocument2 オブジェクトのimagesプロパティを使用して、すべての URL 画像を取得できます。

OnDocumentCompleteイベントを使用したこのサンプルを参照してください。

procedure TForm2.WebBrowser1DocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
var
HTMLDocument2: IHTMLDocument2;
i            : Integer;
Item         : IHTMLElement;
ImageUrl     : string;
begin
    HTMLDocument2 := (WebBrowser1.Document AS IHTMLDocument2);
    for i := 0 to HTMLDocument2.images.length -1 do
    begin
    Item := HTMLDocument2.images.item(i, null) As IHTMLElement;
    ImageUrl:=item.getAttribute('src',0);
     //do your stuff with the url image retrieved
    end;
end;
于 2010-09-01T23:27:11.833 に答える
1

OnDocumentCompleteまたはOnNavigateComplete2イベント (SHDocVw ヘルプを参照) を使用するか、WebBrowserが にあるのを待ってReadyState READYSTATE_COMPLETEから から読み取ることができWebBrowser.Documentます。

ただし、(より単純な IMO) a を使用しTIdHTTP.Getて、応答ストリームを直接取得することもできます。

于 2010-09-01T23:12:32.300 に答える