use of com.seleniumtests.uipage.htmlelements.HtmlElement in project seleniumRobot by bhecquet.
the class TestDriver method testFindHtmlElementsByNotExist.
/**
* Tests NOT finding sub-elements of an HTMLElement
* No exception should be raised but search should be done several times
*/
public void testFindHtmlElementsByNotExist() {
SeleniumTestsContextManager.getThreadContext().setReplayTimeout(7);
long start = new Date().getTime();
Assert.assertEquals(new HtmlElement("", By.className("myClass")).findHtmlElements(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 testFindHtmlElementsByInsideFrame.
/**
* Tests finding sub-elements of an HTMLElement inside frame
* issue #314: search for an element into iframe. Search sub-elements of this element.
* We search in the second table because the bug relies in the fact that findHtmlElements do return elements which do not correspond the the elements returned
* by a simple driver.findElements(By.tagname('a'))
*/
public void testFindHtmlElementsByInsideFrame() {
List<WebElement> htmlElements = new HtmlElement("", By.id("tableIframe2"), DriverTestPage.iframe).findHtmlElements(By.tagName("td"));
Assert.assertEquals(htmlElements.size(), 2);
Assert.assertTrue(htmlElements.get(0) instanceof HtmlElement);
Assert.assertEquals(htmlElements.get(0).getText(), "Value 3");
}
use of com.seleniumtests.uipage.htmlelements.HtmlElement in project seleniumRobot by bhecquet.
the class DriverTestPageWithoutFixedPattern method move.
public void move() {
CustomEventFiringWebDriver driver = (CustomEventFiringWebDriver) (getDriver());
HtmlElement html = new HtmlElement("", By.tagName("html"));
driver.manage().window().getPosition();
driver.manage().window().getSize();
driver.getViewPortDimensionWithoutScrollbar();
new Actions(driver).moveToElement(html).moveByOffset(10, 100).click().perform();
driver.getCurrentUrl();
}
use of com.seleniumtests.uipage.htmlelements.HtmlElement in project seleniumRobot by bhecquet.
the class TestByC method testByOrWithPlatformSpecificLocator.
/**
* Test specific locator with non mobile platform. No element should be found
*/
@Test(groups = { "it" }, expectedExceptions = NoSuchElementException.class)
public void testByOrWithPlatformSpecificLocator() {
SeleniumTestsContextManager.getThreadContext().setReplayTimeout(3);
new HtmlElement("or", ByC.or(android(By.id("text2")))).getTagName();
}
use of com.seleniumtests.uipage.htmlelements.HtmlElement in project seleniumRobot by bhecquet.
the class TestFrameElement method testUseElementInsideFrameRetryOnError.
@Test(groups = { "ut" })
public void testUseElementInsideFrameRetryOnError() throws Exception {
FrameElement frame = new FrameElement("", By.id("frameId"));
HtmlElement el = new HtmlElement("", By.id("el"), frame);
Mockito.doThrow(new WebDriverException("fake exception")).doNothing().when(element).click();
el.click();
// 2 invocations because first call to click raises an error
verify(locator, times(2)).frame(any(WebElement.class));
verify(locator, times(2)).defaultContent();
}
Aggregations