2015-01-09 144 views
2

我正在開發一個android項目,我需要從WebView的網站驗證一些數據。有沒有什麼辦法從WebView拉URL鏈接?我的WebView不顯示地址欄,其隱藏。Appium:如何在webview中獲取URL

我一直在使用

Set<String> contextNames = driver.getContextHandles(); 
     for (String contextName : contextNames) { 
      System.out.println(contextNames); 
     } 
     driver.context((String) contextNames.toArray()[1]); 
     driver.context("WEBVIEW"); 
     driver.getcurrentURL(); 
    } 
+0

請張貼一些代碼嘗試,它會更容易明白究竟你在做什麼。 – Andry 2015-01-10 10:32:13

回答

-1

試試這個

WebView webView; 
webView.getUrl(); // Shows the url which is currently loaded in webview 
Log.d("URL", url); // To show the url which has loaded into the webview in LogCat.