use of com.seleniumtests.uipage.htmlelements.HtmlElement in project seleniumRobot by bhecquet.
the class TestPageObject2 method testCaptureElementSnapshotWithCheck.
/**
* Capture element snapshot and sends it to selenium server
*
* @throws IOException
*/
@Test(groups = { "ut" })
public void testCaptureElementSnapshotWithCheck() throws IOException {
page.setScreenshotUtil(screenshotUtil);
String htmlFilePath = page.getHtmlFilePath();
page.captureElementSnapshot("img", new HtmlElement("", By.id("el")), SnapshotCheckType.TRUE);
// check capture has been done on the second call (a first capture is done at
// PageObject init)
Assert.assertFalse(page.getHtmlFilePath().equals(htmlFilePath));
// check scroll delay is 0 by default
verify(screenshotUtil).capture(any(SnapshotTarget.class), eq(ScreenShot.class), eq(0));
}
use of com.seleniumtests.uipage.htmlelements.HtmlElement in project seleniumRobot by bhecquet.
the class TestFrameElement method testUseElementInsideElementInsideFrame.
/**
* Test that we enter the iframe of the parent element when searching looking a sub-element
* @throws Exception
*/
@Test(groups = { "ut" })
public void testUseElementInsideElementInsideFrame() throws Exception {
FrameElement frame = new FrameElement("", By.id("frameId"));
HtmlElement el = new HtmlElement("", By.id("el"), frame);
LinkElement link = el.findLinkElement(By.id("link"));
link.click();
verify(locator).frame(any(WebElement.class));
verify(locator).defaultContent();
}
use of com.seleniumtests.uipage.htmlelements.HtmlElement in project seleniumRobot by bhecquet.
the class TestFrameElement method testUseElementOutsideFrame.
@Test(groups = { "ut" })
public void testUseElementOutsideFrame() throws Exception {
HtmlElement el = new HtmlElement("", By.id("el"));
el.click();
verify(locator, times(0)).frame(any(WebElement.class));
}
use of com.seleniumtests.uipage.htmlelements.HtmlElement in project seleniumRobot by bhecquet.
the class TestFrameElement method testUseElementInside2Frames.
@Test(groups = { "ut" })
public void testUseElementInside2Frames() throws Exception {
FrameElement frame = new FrameElement("", By.id("frameId"));
FrameElement frame2 = new FrameElement("", By.id("frameId2"), frame);
HtmlElement el = new HtmlElement("", By.id("el"), frame2);
el.click();
// switch to each frame
verify(locator, times(2)).frame(any(WebElement.class));
verify(locator).defaultContent();
}
use of com.seleniumtests.uipage.htmlelements.HtmlElement in project seleniumRobot by bhecquet.
the class TestHtmlElement method testElementNotFoundLowTimeout.
@Test(groups = { "ut" })
public void testElementNotFoundLowTimeout() throws Exception {
HtmlElement elNotPresent2 = new HtmlElement("element", By.id("notPresent"), (Integer) null, 5);
when(driver.findElement(By.id("notPresent"))).thenThrow(new NoSuchElementException("Unable to locate element with ID: 'notPresent'"));
LocalDateTime start = LocalDateTime.now();
try {
elNotPresent2.getValue();
} catch (WebDriverException e) {
}
Assert.assertTrue(LocalDateTime.now().minusSeconds(6).isBefore(start));
Assert.assertTrue(LocalDateTime.now().minusSeconds(4).isAfter(start));
}
Aggregations