1

I'm crawling a certain webpage that requires me to click OK to a javascript confirm dialog before showing its content. I know how to automate click on a html button but not a js dialog. I tried :

procedure TMainForm.crmJsdialog(Sender: TObject; const browser: ICefBrowser;
  const originUrl, acceptLang: ustring; dialogType: TCefJsDialogType;
  const messageText, defaultPromptText: ustring; callback: ICefJsDialogCallback;
  out suppressMessage, Result: Boolean);
begin
  Result := True;
end;

but it only suppressed the confirm dialog and won't proceed to the next page.
I'm using cef3 in XE7 if that helps.
Thanks in advance.

Ago
  • 755
  • 7
  • 28

1 Answers1

0

I tried playing with the parameter callback :

procedure TMainForm.crmJsdialog(Sender: TObject; const browser: ICefBrowser;
  const originUrl, acceptLang: ustring; dialogType: TCefJsDialogType;
  const messageText, defaultPromptText: ustring; callback: ICefJsDialogCallback;
  out suppressMessage, Result: Boolean);
begin
  if dialogType = TCefJsDialogType.JSDIALOGTYPE_CONFIRM then
  begin
    callback.Cont(True, '');
    Result := True;
  end;
end;

and got my intended results. The code is working in my side so far.. Tested.

Ago
  • 755
  • 7
  • 28