All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.katalon.kata.selenium.PageTemplate Maven / Gradle / Ivy

There is a newer version: 1.0.5
Show newest version
package com.katalon.kata.selenium;

import com.katalon.kata.helper.LogHelper;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.slf4j.Logger;

import java.util.function.Function;

public class PageTemplate {

  protected static final Logger log = LogHelper.getLogger();

  protected WebDriver driver;

  public void init(WebDriver driver) {
    log.info("Initializing Page: {}", this.getClass().getName());
    this.driver = driver;
    initElements(driver);
  }

  public void initElements(WebDriver driver) {
    PageFactory.initElements(driver, this);
  }

  protected void waitUtil(Function isTrue) {
    waitUtil(isTrue, 10);
  }

  protected void waitUtil(Function isTrue, long timeOutInSeconds) {
    WebDriverWait webDriverWait = new WebDriverWait(driver, timeOutInSeconds);
    webDriverWait.until(isTrue);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy