fill form programmatically in Android Webview - JavaScript

后端 未结 4 924
灰色年华
灰色年华 2021-01-15 07:33

I\'m trying to automatically fill a form from the website of my school. I\'ve seen some ways to do with javascrip.

Here is my code:

@Override
prote         


        
4条回答
  •  无人共我
    2021-01-15 08:10

    You just need to enable domelements

          myview.getSettings().setDomStorageEnabled(true);
    

    and then use getelementby id like

         javascript:var x = document.getElementById('myfield').value = 'aaa';
    

    and do this in

             onPageFinishedLoading(){}
    

    got this from the link Android WebView always returns null for javascript getElementById on loadUrl

提交回复
热议问题