0
  public static WebView create(final AndroidWebDriver driver) {
 
    WebChromeClient chromeClient = new ChromeClient(driver);
    WebViewClient viewClient = new ViewClient(driver);
 
    WebView view = new WebView(driver.getActivity());
    view.setWebChromeClient(chromeClient);
    view.setWebViewClient(viewClient);
 
    final float zoom = view.getScale();
 
    view.setOnFocusChangeListener(new View.OnFocusChangeListener() {
      public void onFocusChange(View view, boolean focused) {
        // When a text area is focused, webview's focus is false 
        if (!focused) {
          driver.setEditAreaHasFocus(true);
        } 
      } 
    }); 
     
    view.addJavascriptInterface(jsInterface, "webdriver");
 
    initWebViewSettings(view);
     
    return view;
  } 
 
  public static void initWebView(final AndroidWebDriver driver,WebView view) {
		view.setOnFocusChangeListener(new View.OnFocusChangeListener() {
			public void onFocusChange(View view, boolean focused) {
				// When a text area is focused, webview's focus is false 
				if (!focused) {
					driver.setEditAreaHasFocus(true);
				} 
			} 
		}); 
 
		view.addJavascriptInterface(jsInterface, "webdriver");
 
		initWebViewSettings(view);
 
	} 
   
  private WebDriverWebView() {} 
 
  private static void initWebViewSettings(WebView view) {
    // Clearing the view 
    view.clearCache(true);
    view.clearFormData();
    view.clearHistory();
    view.clearView();
 
    view.requestFocus(View.FOCUS_DOWN);
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
 
    // Webview settings 
    WebSettings settings = view.getSettings();
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    settings.setSupportMultipleWindows(true);
    settings.setBuiltInZoomControls(true);
    settings.setJavaScriptEnabled(true);
    /*settings.setAppCacheEnabled(true); 
    settings.setAppCacheMaxSize(10*1024*1024); 
    settings.setAppCachePath("");*/ 
    settings.setDatabaseEnabled(true);
    settings.setDomStorageEnabled(true);
    settings.setGeolocationEnabled(true);
    settings.setSaveFormData(true);
    settings.setRenderPriority(WebSettings.RenderPriority.HIGH);
 
    // Same as the browser settings 
    settings.setLoadWithOverviewMode(true);
    settings.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
    settings.setDefaultZoom(ZoomDensity.valueOf("MEDIUM"));
    settings.setUseWideViewPort(true);
    settings.setMinimumFontSize(1);
    settings.setMinimumLogicalFontSize(1);
    settings.setDefaultFontSize(16);
    settings.setDefaultFixedFontSize(13);
     
    view.enablePlatformNotifications();
    view.setNetworkAvailable(true);
  } 
}