I need to fill in a text box programmatically on a web page open inside a WebView. How?

I created a WebView and opened a web page containing a form in it. I need to fill out this form programmatically (I need to get the sqlite database of data and fill it out).

How can i do this? can anyone help me.

EDIT: A webpage is a registration form, and I do not own this webpage. I can not add java script to this page.

+5
source share
1 answer

I would use javascript in this situation.

Here is how. Make your web browser javascript enabled.

Java code in your web browsing activity

webview.loadUrl("javascript: fillUpForm(inputId,inputValue)");

javascript in your html file

function fillUpForm(id,value)
{
  document.findElementById(id).value=value;
}

Honestly, I am not an expert in javascript. But that should give you a starting point.


,

view.loadUrl("javascript:(function(){document.getElementById('trop').value='some value';})()");
+6

All Articles