0

I've faced the problem with filling fields of a page. When BrowserDocumentComplete event is launched I don't have any content to work with. If I put the URL constant's value into IE's url field the page will be loaded. I think that it is somehow connected with the page I navigate to: it has .srf extention. I haven't find any examples of working with such pages so I hope someone can help me here. All I have found is the description of this file type: Server Response File.

Thanks in advance!

P.S. Here's the code where I try to fill the fields:

procedure TForm1.BrowserDocumentComplete(ASender: TObject; const pDisp: IDispatch; const URL: OleVariant);
var
  I: Integer;
  Document: IHTMLDocument2;
  Tags: IHTMLElementCollection;
  Element: IHTMLElement;
begin
  if ASender is TWebBrowser then
  begin
    Document := TWebBrowser(ASender).Document as IHTMLDocument2;
    if Assigned(Document) then
    begin    
      ... //Here Document.body.innerHtml is empty
    end;
  end;
end;
Maxim
  • 199
  • 1
  • 14
  • Srf makes no difference here. Can you provide to the actual URL? – kobik Jul 31 '15 at 11:15
  • https://login.live.com/oauth20_authorize.srf?client_id=XXXXX&response_type=code&scope=wl.signin%2Cwl.basic%2Cwl.offline_access%2Cwl.skydrive%2Cwl.skydrive_update%2Cwl.offline_access&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf where XXXXX is my appId from the developer's console. (OneDrive API). – Maxim Jul 31 '15 at 11:29
  • I cannot test this (no appId), but you need to examine the URL on BrowserDocumentComplete (browser might be redirected) and make sure that you access the top level frame. this is related or even a duplicate: [Application locks while trying to access TWebbrowsers HTML](http://stackoverflow.com/q/5930725/937125) – kobik Jul 31 '15 at 11:40
  • > you need to examine the URL on BrowserDocumentComplete The URL is exactly the same as I've posted above. The problem is that OnDocumentComplete launches only one time. So even if there's some redirect, this event doesn't launch again for unknown reason. – Maxim Jul 31 '15 at 11:43

0 Answers0