@Test public void logElement() throws Exception { RemoteUIADriver driver = null; try { driver = new RemoteUIADriver( getRemoteURL(), SampleApps.intlMountainsCap(Locale.FRENCH.toString())); Criteria c1 = new TypeCriteria(UIATableCell.class); UIAElement element = driver.findElement(c1); element.tap(); NameCriteria criteria = new NameCriteria("sentenceFormat", L10NStrategy.serverL10N, MatchingStrategy.regex); UIAElement el = driver.findElement(criteria); JSONObject log = el.logElementTree(null, true); Orientation o = Orientation.fromInterfaceOrientation(log.getInt("deviceOrientation")); Assert.assertEquals(o, Orientation.UIA_DEVICE_ORIENTATION_PORTRAIT); JSONObject tree = log.getJSONObject("tree"); Assert.assertEquals(tree.getString("type"), "UIAStaticText"); Assert.assertEquals(tree.getString("value"), expected); Assert.assertEquals(tree.getString("label"), expected); Assert.assertEquals(tree.getString("name"), expected); Assert.assertNull(tree.optJSONArray("children")); log = driver.logElementTree(null, true); o = Orientation.fromInterfaceOrientation(log.getInt("deviceOrientation")); Assert.assertEquals(o, Orientation.UIA_DEVICE_ORIENTATION_PORTRAIT); tree = log.getJSONObject("tree"); Assert.assertEquals(tree.getString("type"), "UIAApplication"); Assert.assertEquals(tree.get("value"), JSONObject.NULL); Assert.assertEquals(tree.get("label"), "Montagnes"); Assert.assertEquals(tree.get("name"), "Montagnes"); Assert.assertEquals(tree.optJSONArray("children").length(), 2); } finally { if (driver != null) { driver.quit(); } } }
@BeforeClass public void startDriver() { driver = new RemoteUIADriver(getRemoteURL(), SampleApps.uiCatalogCap()); }
@BeforeClass public void startDriver() { driver = new RemoteWebDriver(getRemoteURL(), SampleApps.geoCoderCap()); }