From d4ad20e813403fc6c76fa4f80f19cecf4b6c855c Mon Sep 17 00:00:00 2001 From: Dirk Jahnke Date: Sat, 27 Jul 2019 00:44:24 +0200 Subject: [PATCH] Using switchTo.defaultContent to get root in framed content. --- src/test/java/org/fremo/fredl/test/BasicTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/fremo/fredl/test/BasicTest.java b/src/test/java/org/fremo/fredl/test/BasicTest.java index d2a70a1..c38089c 100644 --- a/src/test/java/org/fremo/fredl/test/BasicTest.java +++ b/src/test/java/org/fremo/fredl/test/BasicTest.java @@ -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