Fill website data and click button and parse response

Home - Fill website data and click button and parse response

Chintia Widyasari asked 11 months ago

I want to let users enter the vehicle number and then read the data and show the vehicle details to the user. I don’t want to do it in a webview. I am able to fill the data using this code:
 

webView = (WebView) findViewById(R.id.webView1);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.loadUrl("https://parivahan.gov.in/rcdlstatus/vahan/rcstatus.xhtml");
        webView.setWebViewClient(new WebViewClient() {
            public void onPageFinished(WebView view, String url) {
                String reg1="KA51X";
                String reg2="8659";
                 if(isFirstLoad) {
                     webView.loadUrl("javascript: {" +
                             "document.getElementById('convVeh_Form:tf_reg_no1').value = '" + reg1 + "';" +
                             "document.getElementById('convVeh_Form:tf_reg_no2').value = '" + reg2 + "';" +
                             "var frms = document.getElementsByName('convVeh_Form');" +
                             "frms[0].submit(); };");

                     isFirstLoad = false;
                 }
            }
        });
Your Answer