olá, preciso pegar o retorno deste codigo em js no webview4delphi ---
var rows = document.getElementsByTagName
("table")[1].rows;
var totalRowCount = rows.length;
alert(totalRowCount-3);
for (var j = 0; j < (totalRowCount-3); j++) {
// numero de rows - linhas
for (var i = 0; i < (15); i++) { // numero
de campos - colunas
var last = rows[j];
var cell = last.cells;
var value = 'J' +String( j).padStart(2, '0') + 'I' +
String(i).padStart(2, '0') + ' - ' + cell.innerHTML
alert(value)
}
}
este codigo funciona no delphi interceptando o alert...
como eu faria isto no webview4delphi .
grato!
Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
interceptar alert de codigo js
- salvadordf
- Posts: 4563
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: interceptar alert de codigo js
Hi,
Set TWVBrowserBase.DefaultScriptDialogsEnabled to false and use the TWVBrowserBase.OnScriptDialogOpening event to suppresses or replace JS dialogs with custom dialogs.
If you are using this to send information to Delphi/Lazarus then consider using the code in the BrowserHostAppCommunication demo.
Set TWVBrowserBase.DefaultScriptDialogsEnabled to false and use the TWVBrowserBase.OnScriptDialogOpening event to suppresses or replace JS dialogs with custom dialogs.
If you are using this to send information to Delphi/Lazarus then consider using the code in the BrowserHostAppCommunication demo.
Re: interceptar alert de codigo js
tentei capturar o retorno do script
através de
procedure TMainForm.WVBrowser1ScriptDialogOpening(Sender: TObject;
const aWebView: ICoreWebView2;
const aArgs: TCoreWebView2ScriptDialogOpeningEventArgs);
ele dá o alert na tela mas não passa pela procedure acima no debug.
através de
procedure TMainForm.WVBrowser1ScriptDialogOpening(Sender: TObject;
const aWebView: ICoreWebView2;
const aArgs: TCoreWebView2ScriptDialogOpeningEventArgs);
ele dá o alert na tela mas não passa pela procedure acima no debug.
- salvadordf
- Posts: 4563
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: interceptar alert de codigo js
It's necessary to set TWVBrowserBase.DefaultScriptDialogsEnabled to False when the browser is already initialized.
Use the TWVBrowserBase.OnAfterCreated event to set TWVBrowserBase.DefaultScriptDialogsEnabled to False.
After that, you will start getting the TWVBrowserBase.OnScriptDialogOpening events.
Use the TWVBrowserBase.OnAfterCreated event to set TWVBrowserBase.DefaultScriptDialogsEnabled to False.
After that, you will start getting the TWVBrowserBase.OnScriptDialogOpening events.
Re: interceptar alert de codigo js
valeu, deu certo, obrigado!