Skip to content

Instantly share code, notes, and snippets.

@tymbark
Last active September 13, 2017 09:01
Show Gist options
  • Save tymbark/1d82386660ea70363c40e63993c8de12 to your computer and use it in GitHub Desktop.
Save tymbark/1d82386660ea70363c40e63993c8de12 to your computer and use it in GitHub Desktop.
Fill webpage input from android (webview)
final WebView webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebChromeClient(new WebChromeClient());
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
String jsContent = "function() { document.getElementById('email').value = '[email protected]';}";
view.loadUrl("javascript:(" + jsContent + ")()");
}
});
webView.loadUrl("https://www.paypal.com/signin?country.x=PL&locale.x=pl_PL");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment