So, reading around, I read that I can “embed” javascript on a loaded web page to program the filling out of the website form, so I tried the following:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); WebView WebView; WebView = (WebView) findViewById(R.id.webview); WebView.setWebViewClient(new HelloWebViewClient()); WebView.getSettings().setJavaScriptEnabled(true); WebView.getSettings().setBlockNetworkImage(false); WebView.loadUrl("http://www.kingsage.es"); String username = "XXX"; String Password = "YYY"; WebView.loadUrl("javascript:document.getElementById('login_player').value='"+username+"';javascript:document.getElementById('login_passwd').value = '"+Password+"';"); }
However, when I run this on the emulator, I get an error message as if the website was not found. if I disable the second loadUrl method, I load the website, but I need to fill out the login form programmatically !, I believe that I am doing something wrong, but I did not find and did not read. Any help would be appreciated!
source share