/** Try access elements on page which are lazy loaded and not presented on the page. */ @Test public void testAccessLazyNotExistingListElement() throws CreatePageException { driver.get(ResourceUtil.getResourceURI("noElement.html")); TestPageListElementLazy testPage = pageFactory.initPage(TestPageListElementLazy.class); // access elements - here they are located assertEquals(testPage.getTexts().size(), 0); }
/** Should pass fine because elements are present on the page during lazy loading */ @Test public void testAccessLazyExistingListElement() throws CreatePageException { driver.get(ResourceUtil.getResourceURI("elementList.html")); TestPageListElementLazy testPage = pageFactory.initPage(TestPageListElementLazy.class); // here are the elements loaded assertEquals(testPage.getTexts().size(), 5); for (WebDriverElement text : testPage.getTexts()) assertEquals(text.getText(), "some text"); }