use of com.seleniumtests.uipage.htmlelements.HtmlElement in project seleniumRobot by bhecquet.
the class TestDriver method testFindElementsByNotExist.
/**
* Tests NOT finding sub-elements of an HTMLElement
* No exception should be raised but search should be done several times
*/
public void testFindElementsByNotExist() {
SeleniumTestsContextManager.getThreadContext().setReplayTimeout(7);
long start = new Date().getTime();
Assert.assertEquals(new HtmlElement("", By.className("myClass")).findElements(By.id("foobarId")).size(), 0);
Assert.assertTrue(new Date().getTime() - start > 6500);
}
use of com.seleniumtests.uipage.htmlelements.HtmlElement in project seleniumRobot by bhecquet.
the class TestDriver method testFindElementsNotExist.
/**
* Check that if no element is returned, no error is raised but we should have searched several times
*/
public void testFindElementsNotExist() {
SeleniumTestsContextManager.getThreadContext().setReplayTimeout(7);
long start = new Date().getTime();
Assert.assertEquals(new HtmlElement("", By.name("foobar")).findElements().size(), 0);
Assert.assertTrue(new Date().getTime() - start > 6500);
}
use of com.seleniumtests.uipage.htmlelements.HtmlElement in project seleniumRobot by bhecquet.
the class TestDriver method testWebDriverWaitWithLowTimeout.
/**
* issue #194: check that the WebDriverWait timeout is the one really applied
*/
public void testWebDriverWaitWithLowTimeout() {
long start = new Date().getTime();
try {
new WebDriverWait(driver, 2).until(ExpectedConditions.visibilityOf(new HtmlElement("", By.id("someNonExistentId"))));
} catch (TimeoutException e) {
}
// we cannot check precise timing as it depends on the hardware, but we should never wait more that 10 secs (the default timeout for searching element is 30 secs)
Assert.assertTrue(new Date().getTime() - start < 10000);
}
use of com.seleniumtests.uipage.htmlelements.HtmlElement in project seleniumRobot by bhecquet.
the class TestDriver method testFindHtmlElementsByWithSimilarElements.
/**
* issue #314: check that we search element effectively inside the parent
*/
public void testFindHtmlElementsByWithSimilarElements() {
List<WebElement> htmlElements = new HtmlElement("", By.id("parent")).findHtmlElements(By.tagName("div"));
Assert.assertEquals(htmlElements.size(), 3);
Assert.assertTrue(htmlElements.get(0) instanceof HtmlElement);
Assert.assertEquals(htmlElements.get(0).getText(), "first child");
}
use of com.seleniumtests.uipage.htmlelements.HtmlElement in project seleniumRobot by bhecquet.
the class TestDriver method testFindHtmlElementsBy.
/**
* Tests finding sub-elements of an HTMLElement
*/
public void testFindHtmlElementsBy() {
List<WebElement> htmlElements = new HtmlElement("", By.id("parent")).findHtmlElements(By.className("myClass"));
Assert.assertEquals(htmlElements.size(), 2);
Assert.assertTrue(htmlElements.get(0) instanceof HtmlElement);
Assert.assertEquals(htmlElements.get(0).getText(), "first child");
}
Aggregations