#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#BridgeLogger:True
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
End Sub
Sub Globals
Dim LogonUrl As String="https://www.dgca.gov.in/digigov-portal/jsp/dgca/common/login.jsp"
Dim WebView1 As WebView
Dim WebViewExtras1 As WebViewExtras
End Sub
Sub Activity_Create(FirstTime As Boolean)
WebView1.Initialize("WebView1")
Activity.AddView(WebView1, 0, 0, 100%x, 100%y)
WebViewExtras1.Initialize(WebView1)
Dim WebChromeClient1 As DefaultWebChromeClient
WebChromeClient1.Initialize("WebChromeClient1")
WebViewExtras1.SetWebChromeClient(WebChromeClient1)
WebView1.LoadUrl(LogonUrl)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub WebView1_PageFinished (Url As String)
Log("WebView1_PageFinished")
If Url=LogonUrl Then
Dim Javascript As StringBuilder
Javascript.Initialize
Javascript.Append("document.forms.captcha_val.username.value='My_username';")
Javascript.Append("document.forms.captcha_val.password.value='My_password';")
' uncomment next line to auto submit the logon form
' be careful - if logon fails then the webpage will be reloaded
' and an infinite loop of failed logons is likely
Javascript.Append("document.forms.captcha_val.submit();")
WebViewExtras1.ExecuteJavascript(Javascript.ToString)
Log("Form updated")
End If
End Sub