Using switchTo.defaultContent to get root in framed content.

This commit is contained in:
Dirk Jahnke 2019-07-27 00:44:24 +02:00
parent 5c5d50ec13
commit d4ad20e813
1 changed files with 6 additions and 3 deletions

View File

@ -64,6 +64,7 @@ public class BasicTest {
// FredlTestHelper.printPageSource(driver);
driver.switchTo().defaultContent();
String frameObenName = "oben";
wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(frameObenName));
@ -76,7 +77,7 @@ public class BasicTest {
System.out.println("User info found: " + userInfo);
Assert.assertEquals(userInfo, expectedUserInfo);
driver.switchTo().parentFrame();
driver.switchTo().defaultContent();
String frameRechtsName = "rechts";
driver.switchTo().frame(frameRechtsName);
@ -88,11 +89,12 @@ public class BasicTest {
Assert.assertEquals(welcomeMessage, expectedWelcomeMessage);
// we leave our tests always with having the driver located to the top frame
driver.switchTo().parentFrame();
driver.switchTo().defaultContent();
}
@Test
public void verifyExistenceOfMainMenuButtons() {
driver.switchTo().defaultContent();
driver.switchTo().frame("oben");
// Verify existence of menu buttons
Assert.assertEquals(FredlTestHelper.elementExistsById("admin-menu-button"), true);
@ -106,7 +108,8 @@ public class BasicTest {
Assert.assertEquals(FredlTestHelper.elementExistsById("calendar-menu-button"), true);
Assert.assertEquals(FredlTestHelper.elementExistsById("idman-menu-button"), true);
Assert.assertEquals(FredlTestHelper.elementExistsById("lola-menu-button"), true);
Assert.assertEquals(FredlTestHelper.elementExistsById("logout-menu-button"), true); driver.switchTo().parentFrame();
Assert.assertEquals(FredlTestHelper.elementExistsById("logout-menu-button"), true);
driver.switchTo().defaultContent();
}
@Test