Example #1
0
  /**
   * Should pass fine because we are locating elements during page initialization which are present
   * on the page
   */
  @Test
  public void testFindNotLazyExistingListElement() throws CreatePageException {
    driver.get(ResourceUtil.getResourceURI("elementList.html"));
    TestPageListElement testPage = pageFactory.initPage(TestPageListElement.class);

    assertEquals(testPage.getTexts().size(), 5);
  }
Example #2
0
  /** 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);
  }
Example #3
0
  /** Should pass fine because elements are initialized during page initialization */
  @Test
  public void testAccessNotLazyExistingListElement() throws CreatePageException {
    driver.get(ResourceUtil.getResourceURI("elementList.html"));
    TestPageListElement testPage = pageFactory.initPage(TestPageListElement.class);

    assertEquals(testPage.getTexts().size(), 5);

    for (WebDriverElement text : testPage.getTexts()) assertEquals(text.getText(), "some text");
  }
Example #4
0
 /** Should pass fine because we specify elements as lazy */
 @Test
 public void testFindLazyExistingListElement() throws CreatePageException {
   driver.get(ResourceUtil.getResourceURI("elementList.html"));
   TestPageListElementLazy testPage = pageFactory.initPage(TestPageListElementLazy.class);
 }