标签:handle system contains cto filter native list() ati text
Set<String> contexts = driver.getContextHandles(); for(String item :contexts){ // NATIVE_APP //WEBVIEW_com.xxx.xxxx System.out.println(item); } Set<String> contextNames = driver.getContextHandles(); List<String> webViewContextNames = contextNames .stream() .filter(contextName -> contextName.contains("WEBVIEW_")) .collect(Collectors.toList()); String currentContextView = ""; if (webViewContextNames.size() > 0){ currentContextView = (String) webViewContextNames .toArray()[webViewContextNames.size()-1]; driver.context(currentContextView); }
driver.context(currentContextView);
执行的是切换到最后一个webview
标签:handle system contains cto filter native list() ati text
原文地址:https://www.cnblogs.com/testway/p/9300426.html