本文整理汇总了Java中java.util.Stack.forEach方法的典型用法代码示例。如果您正苦于以下问题:Java Stack.forEach方法的具体用法?Java Stack.forEach怎么用?Java Stack.forEach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Stack
的用法示例。
在下文中一共展示了Stack.forEach方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAllElementsInFrames
import java.util.Stack; //导入方法依赖的package包/类
private List<WebElement> getAllElementsInFrames(TeasyElement context, final By by, Stack<WebElement> currentFramesPath) {
List<WebElement> foundInCurrentFrame = newArrayList();
if (firstCallInContext.get()) {
avoidStaleness(context);
List<WebElement> elements = context.getWrappedWebElement().findElements(by);
if (!elements.isEmpty()) {
foundInCurrentFrame.addAll(elements);
}
}
if (!firstCallInContext.get()) {
foundInCurrentFrame.addAll(newArrayList(transform(driverFindElements(by), toFrameAwareWebElements)));
}
List<WebElement> currentFrames = getFramesForContext(context);
for (WebElement frame : currentFrames) {
if (!switchToFrame(frame)) {
continue;
}
currentFramesPath.push(frame);
//For resolve UnreachableBrowserException due to - java.net.SocketException: No buffer space available (maximum connections reached?): connect
//http://stackoverflow.com/questions/1226155/hunt-down-java-net-socketexception-no-buffer-space-available
TestUtils.waitForSomeTime(50, "Wait for resolve UnreachableBrowserException, due to - SocketException: No buffer space available");
foundInCurrentFrame.addAll(getAllElementsInFrames(context, by, currentFramesPath));
currentFramesPath.pop();
switchToDefaultContext();
currentFramesPath.forEach(this::switchToFrame);
}
return foundInCurrentFrame;
}
示例2: findFirstElements
import java.util.Stack; //导入方法依赖的package包/类
private List<WebElement> findFirstElements(TeasyElement context, final By by, Stack<WebElement> currentFramesPath) {
if (firstCallInContext.get()) {
avoidStaleness(context);
List<WebElement> elements = context.getWrappedWebElement().findElements(by);
if (!elements.isEmpty()) {
return elements;
}
}
if (!firstCallInContext.get()) {
final List<WebElement> foundInCurrentFrame = newArrayList(transform(driverFindElements(by), toFrameAwareWebElements));
if (isNotEmpty(foundInCurrentFrame)) {
return foundInCurrentFrame;
}
}
List<WebElement> currentFrames = getFramesForContext(context);
for (final WebElement frame : currentFrames) {
if (!switchToFrame(frame)) {
continue;
}
currentFramesPath.push(frame);
final List<WebElement> foundInFrames = findFirstElements(context, by, currentFramesPath);
if (isNotEmpty(foundInFrames)) {
return foundInFrames;
}
currentFramesPath.pop();
getDriver().switchTo().defaultContent();
currentFramesPath.forEach(this::switchToFrame);
}
return emptyList();
}