java - fill form programmatically in Android Webview - JavaScript -
I am trying to fill the form automatically from my school's website. I have seen some ways with javascript
Here is my code:
@Override protected Zero onCreate (bundled savedInstanceState) {super.onCreate (savedInstanceState); SetContentView (R.layout.navegador_siiau_layout); Navegador_siiau = (webview) Find VVBiID (R.DDWWI_NEVEVER_SIU); Navegador_siiau.getSettings () setJavaScriptEnabled (true). Navegador_siiau.loadUrl ("http://siiauescolar.siiau.udg.mx/wus/gupprincipal.inicio"); Document.getElementsByName ('p_codigo_c'); String pwd = "FENMAA"; View.loadUrl ("JavaScript navegador_siiau.setWebViewClient (the new WebViewClient () {Public Zero (for viewing WebView, string URL) {string user =" 207,512,134 "onPageFinished.value = '" + user + "'; document.getElementsByName (' P_clave_c '). Value =' "+ pwd +" '; ");}}); }
The result is an empty page, whose final string I try to put in the form ... What can I do to fill out the form and submit it correctly?
This is untested, but I see two things wrong here: You should call You are not calling, asynchronous Edit 2:. I finally took a look at the actual page you are working with. The problem is that the page loads content in a separate frame, so you actually have to call
setVebViewClient
with your WebViewClient
implementation before calling loadUrl
. However, loadUrl
then it probably will not make a difference, but it is worth a try that I think. super.onPageFinished (see, url);
You must add this call to InPageFinished getElementsByName
on a separate document, both the information that you want in the frame is located, the name in your page The WebView
as you should be up to:.
window.frames ["mainframe"] document. GetElementsByName ('p_codigo_c') [0] .value = "user"; Window.frames ["mainframe"] Document. GetElementsByName ('p_clave_c') [0] .value = "password";
Comments
Post a Comment