A WebView has several customization points where you can add your own behavior. These are:
WebChromeClient
subclass. This class is called when something that might impact a browser UI happens, for instance, progress updates and JavaScript alerts are sent here (see Debugging Tasks).WebViewClient
subclass. It will be called when things happen that impact the rendering of the content, eg, errors or form submissions. You can also intercept URL loading here (viashouldOverrideUrlLoading()
).WebSettings
, such as enabling JavaScript with setJavaScriptEnabled()
.addJavascriptInterface(Object, String)
method. This method allows you to inject Java objects into a page's JavaScript context, so that they can be accessed by JavaScript in the page.Hi,I am using robotium 3.6 for to automate android web views.and I am trying to write a test case as per below:public void test01() {Activity activity = getActivity();
WebView web;
ArrayList<View> views = solo.getCurrentViews();
for(View view : views) {
if(view instanceof WebView) {
web = (WebView) view;
break;
}// Here i need to execute JavaScript commands on my WebView from Robotium test.}}Can any body help me to verify web elements ?Regards,Reddy