use of com.seleniumtests.uipage.htmlelements.FrameElement in project seleniumRobot by bhecquet.
the class SeleniumNativeActions method recordFrameSwitch.
/**
* Method interceptFindHtmlElement creates an HtmlElement from findElement, but does not handle frames.
* Here, we record all switchTo().frame(WebElement) call to create a FrameElement chain
* @param joinPoint
* @return
* @throws Throwable
*/
@Around(// caller is a PageObject
"this(com.seleniumtests.uipage.PageObject) && " + "(call(public * org.openqa.selenium.support.ui.ExpectedConditions.frameToBeAvailableAndSwitchToIt (..))" + ")")
public Object recordFrameSwitch(ProceedingJoinPoint joinPoint) throws Throwable {
if (Boolean.TRUE.equals(doOverride())) {
Object frameArg = joinPoint.getArgs()[0];
FrameElement frameEl = getFrameElement(frameArg);
if (frameEl == null) {
return joinPoint.proceed(joinPoint.getArgs());
}
if (getCurrentFrame() == null) {
setCurrentFrame(frameEl);
} else {
frameEl.setFrameElement(getCurrentFrame());
setCurrentFrame(frameEl);
}
return new ExpectedCondition<WebDriver>() {
@Override
public WebDriver apply(WebDriver driver) {
try {
return driver;
} catch (NoSuchFrameException e) {
return null;
}
}
@Override
public String toString() {
return "frame to be available: " + frameArg;
}
};
} else {
return joinPoint.proceed(joinPoint.getArgs());
}
}
use of com.seleniumtests.uipage.htmlelements.FrameElement in project seleniumRobot by bhecquet.
the class TestFrameElement method testLinkElementInsideFrame.
@Test(groups = { "ut" })
public void testLinkElementInsideFrame() throws Exception {
FrameElement frame = new FrameElement("", By.id("frameId"));
LinkElement el = new LinkElement("", By.id("el"), frame);
el.click();
verify(locator).frame(any(WebElement.class));
verify(locator).defaultContent();
}
use of com.seleniumtests.uipage.htmlelements.FrameElement 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.FrameElement in project seleniumRobot by bhecquet.
the class TestFrameElement method testButtonElementInsideFrame.
/* tests for each element defined in framework */
/**
* check we switched to default content and frame
* @throws Exception
*/
@Test(groups = { "ut" })
public void testButtonElementInsideFrame() throws Exception {
FrameElement frame = new FrameElement("", By.id("frameId"));
ButtonElement el = new ButtonElement("", By.id("el"), frame);
el.submit();
verify(locator).frame(any(WebElement.class));
verify(locator).defaultContent();
}
use of com.seleniumtests.uipage.htmlelements.FrameElement in project seleniumRobot by bhecquet.
the class TestFrameElement method testTextFieldElementInsideFrame.
@Test(groups = { "ut" })
public void testTextFieldElementInsideFrame() throws Exception {
FrameElement frame = new FrameElement("", By.id("frameId"));
TextFieldElement el = new TextFieldElement("", By.id("el"), frame);
el.sendKeys("toto");
verify(locator).frame(any(WebElement.class));
verify(locator).defaultContent();
}
Aggregations