2015-01-09 145 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.