Delphi 如何在javascript确认对话框3中生成OK
我正在抓取某个网页,该网页要求我在显示javascript确认对话框的内容之前单击OK。我知道如何自动点击html按钮,而不是js对话框。我试过:Delphi 如何在javascript确认对话框3中生成OK,delphi,tchromium,Delphi,Tchromium,我正在抓取某个网页,该网页要求我在显示javascript确认对话框的内容之前单击OK。我知道如何自动点击html按钮,而不是js对话框。我试过: procedure TMainForm.crmJsdialog(Sender: TObject; const browser: ICefBrowser; const originUrl, acceptLang: ustring; dialogType: TCefJsDialogType; const messageText, defaultP
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;
但它只抑制了确认对话框,不会进入下一页。如果有帮助的话,我正在XE7中使用cef3。
提前感谢。我尝试过使用参数回调:
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;
得到了我想要的结果。到目前为止,代码在我这边起作用。。已测试。我尝试使用参数回调:
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;
得到了我想要的结果。到目前为止,代码在我这边起作用。。测试