Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.maxsoft.webautomation.common;
- import com.maxsoft.webautomation.util.driver.Driver;
- import org.openqa.selenium.support.PageFactory;
- import org.openqa.selenium.*;
- import org.openqa.selenium.support.ui.*;
- import org.openqa.selenium.support.ui.ExpectedConditions;
- /**
- * Project Name : Web-Cross-Browser-Automation-Demo
- * Developer : Osanda Deshan
- * Version : 1.0.0
- * Date : 8/25/2018
- * Time : 2:37 PM
- * Description :
- **/
- public abstract class Base {
- protected static String URL = System.getenv("application_endpoint");
- private WebDriver driver = Driver.driver;
- public Base() {
- PageFactory.initElements(driver, this);
- }
- protected void waitForElementClickable(WebElement element){
- WebDriverWait wait = new WebDriverWait(driver, 30);
- wait.until(ExpectedConditions.elementToBeClickable(element));
- }
- protected void waitForElementVisible(WebElement element){
- WebDriverWait wait = new WebDriverWait(driver, 30);
- wait.until(ExpectedConditions.visibilityOf(element));
- }
- protected void setTextAs(WebElement element, String text){
- waitForElementClickable(element);
- element.sendKeys(text);
- }
- protected void clickElement(WebElement element){
- waitForElementClickable(element);
- element.click();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement