This commit is contained in:
Dirk Jahnke 2019-07-27 19:09:25 +02:00
parent 2d69a31b51
commit b4205dcb4d
2 changed files with 5 additions and 4 deletions

View File

@ -116,7 +116,8 @@ public class BasicTest {
public void verifyLogout() { public void verifyLogout() {
driver.switchTo().defaultContent(); driver.switchTo().defaultContent();
FredlTestHelper.printPageSource(); FredlTestHelper.printPageSource();
driver.switchTo().frame("oben"); String frameObenName = "oben";
driver.switchTo().frame(frameObenName);
driver.findElement(By.id("logout-menu-button")).click(); driver.findElement(By.id("logout-menu-button")).click();

View File

@ -22,24 +22,24 @@ public class FredlTestHelper {
} }
public static boolean elementExistsByXpath(String xpath) { public static boolean elementExistsByXpath(String xpath) {
System.out.println("elementExistsByXpath for " + xpath);
driver.manage().timeouts().implicitlyWait(0, TimeUnit.MILLISECONDS); driver.manage().timeouts().implicitlyWait(0, TimeUnit.MILLISECONDS);
boolean exists = driver.findElements(By.xpath(xpath)).size() != 0; boolean exists = driver.findElements(By.xpath(xpath)).size() != 0;
System.out.println("elementExistsByXpath for " + xpath + " = " + exists);
driver.manage().timeouts().implicitlyWait(implicitTimeoutMilliseconds, TimeUnit.MILLISECONDS); driver.manage().timeouts().implicitlyWait(implicitTimeoutMilliseconds, TimeUnit.MILLISECONDS);
return exists; return exists;
} }
public static boolean elementExistsById(String id) { public static boolean elementExistsById(String id) {
System.out.println("elementExistsById for " + id);
driver.manage().timeouts().implicitlyWait(0, TimeUnit.MILLISECONDS); driver.manage().timeouts().implicitlyWait(0, TimeUnit.MILLISECONDS);
boolean exists = driver.findElements(By.id(id)).size() != 0; boolean exists = driver.findElements(By.id(id)).size() != 0;
System.out.println("elementExistsById for " + id + " = " + exists);
driver.manage().timeouts().implicitlyWait(implicitTimeoutMilliseconds, TimeUnit.MILLISECONDS); driver.manage().timeouts().implicitlyWait(implicitTimeoutMilliseconds, TimeUnit.MILLISECONDS);
return exists; return exists;
} }
public static void skipConsentCookiePage() { public static void skipConsentCookiePage() {
if (FredlTestHelper.elementExistsById("privacy-cookie-statement")) { if (FredlTestHelper.elementExistsById("privacy-cookie-statement")) {
System.out.println("Cookies consent page is shown"); System.out.println("Cookies consent page is shown -- accepting");
WebElement consentButton = driver.findElement(By.id("opt-in-button-allow")); WebElement consentButton = driver.findElement(By.id("opt-in-button-allow"));
consentButton.click(); consentButton.click();
} }