Sub Process_Globals
End Sub
Sub Globals
Private ww As WebViewExtras
Private webCaptcha As WebView
Private btConsultar as Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
ww.addJavascriptInterface(webCaptcha, "B4A")
webCaptcha.LoadUrl("http://xxxxxxxxxxxxxxx")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub webCaptcha_PageFinished (Url As String)
Sleep(2500)
Dim Javascript As String
Javascript="B4A.CallSub('Process_HTML', false, document.documentElement.outerHTML)"
ww.executeJavascript(webCaptcha, Javascript)
End Sub
Sub Process_Html(Html As String) 'IGNORE
CallSubDelayed2(Me, "Process_HtmlImpl", Html)
End Sub
Sub Process_HtmlImpl(Html As String) 'HERE YOU HAVE THE HTML CODE OF WEBVIEW
if Html.ToLowerCase.Contains("cpf") then
btConsultar.Visible = true
end if
End Sub
Sub btConsultar_Click
'HERE FILL IN THE FORM'S CPF FIELD (YOU CAN CHANGE CPF for another FIELD)
ww.executeJavascript(webCaptcha,"document.getElementById('cpf').value='"&edCpf.Text&"';")
'HERE IS HOW TO CLICK ON WEBVIEW FORM BUTTON, CHANGE btnConsultaAvancar TO YOUR BUTTON
ProgressDialogShow2("Carregando...",False)
ww.executeJavascript(webCaptcha,"document.getElementById('btnConsultaAvancar').click();")
End Sub