我正在开发一个 android 项目,我需要在 WebView
中验证来自网站的一些数据。有没有办法从 WebView
中提取 URL 链接?我的 WebView
不显示地址栏,它是隐藏的。
我试过用
Set<String> contextNames = driver.getContextHandles();
for (String contextName : contextNames) {
System.out.println(contextNames);
}
driver.context((String) contextNames.toArray()[1]);
driver.context("WEBVIEW");
driver.getcurrentURL();
}
最佳答案
试试这个
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.
关于java - Appium:如何在 webview 中获取 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27869145/