Fill fields in webview automatically

前端 未结 6 1730
小蘑菇
小蘑菇 2020-11-27 04:26

I have seen this question floating around the internet, but I haven\'t found a working solution yet. Basically, I want to load my app and press a button; the button action w

6条回答
  •  生来不讨喜
    2020-11-27 05:06

    This worked for me to fill form values and submitting the form:

    webView.loadUrl("javascript: {" +
                "document.getElementById('username').value = '"+uname +"';" +
                "document.getElementById('password').value = '"+password+"';" +
                "var frms = document.getElementsByName('loginForm');" +
                "frms[0].submit(); };");
    

提交回复
热议问题