} catch (NoSuchWindowException e) {
// expected
}
UIAElement el =
driver.findElement(
new AndCriteria(new TypeCriteria(UIATableCell.class), new NameCriteria("Web",
MatchingStrategy.starts)));
el.tap();
while (driver.getWindowHandles().size() != 2) {
Thread.sleep(50);
}
handles = driver.getWindowHandles();
Assert.assertEquals(handles.size(), 2);
UIAElement back = driver
.findElement(
new AndCriteria(new TypeCriteria(UIAButton.class), new NameCriteria("Back")));
back.tap();
long deadline = System.currentTimeMillis() + 5000;
while (driver.getWindowHandles().size() != 1) {
Thread.sleep(50);
if (System.currentTimeMillis() > deadline) {