javascript - Accessing multiple pages of a website using webview in Android -


im using webview in android studio login website user provided credentials. im able access javascript on login page , through fill in fields , login. want auto click on other buttons or access text fields on 2nd or 3rd page of website after logging in. im confused on how access javascript other pages. should load 2nd page or on url , set webviewclient on again? because first time page loads , calls webviewclient, there can single javascript call in onpagefinished function. if add calls second page in same function, keeps on refreshing page , nothing else second page.

i have read questions came across , read alot couldn't land particular solution. im new android , java, im being unable draw picture of should done after multiple tries. guidance appreciated. also, please tell me scenarios javascriptinterface used call java javascript in webview. im not clear usage.

here's how succeeded first login page:

    mybtn = (button) findviewbyid(r.id.launchbutton);     mywebview = (webview) findviewbyid(r.id.webview);      mywebview.getsettings().setjavascriptenabled(true);     mywebview.getsettings().setdomstorageenabled(true);      mybtn.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {              mywebview.loadurl(url);             gotopage();          }     }); }   private void gotopage(){      mywebview.setwebviewclient(new webviewclient() {         public boolean shouldoverrideurlloading(webview view, string url) {            return false;        }         @override        public void onpagefinished(webview view, string url) {             view.loadurl("javascript:  document.getelementbyid('username').value = '" + username + "';" +                            " document.getelementbyid('password').value = '" + password + "';" +                            " var z =document.getelementbyid('submitbutton').click();");        }    }); } 


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -