Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. package com.maxsoft.webautomation.common;
  2.  
  3. import com.maxsoft.webautomation.util.driver.Driver;
  4. import org.openqa.selenium.support.PageFactory;
  5. import org.openqa.selenium.*;
  6. import org.openqa.selenium.support.ui.*;
  7. import org.openqa.selenium.support.ui.ExpectedConditions;
  8.  
  9. /**
  10. * Project Name : Web-Cross-Browser-Automation-Demo
  11. * Developer : Osanda Deshan
  12. * Version : 1.0.0
  13. * Date : 8/25/2018
  14. * Time : 2:37 PM
  15. * Description :
  16. **/
  17.  
  18.  
  19. public abstract class Base {
  20.  
  21. protected static String URL = System.getenv("application_endpoint");
  22. private WebDriver driver = Driver.driver;
  23.  
  24. public Base() {
  25. PageFactory.initElements(driver, this);
  26. }
  27.  
  28. protected void waitForElementClickable(WebElement element){
  29. WebDriverWait wait = new WebDriverWait(driver, 30);
  30. wait.until(ExpectedConditions.elementToBeClickable(element));
  31. }
  32.  
  33. protected void waitForElementVisible(WebElement element){
  34. WebDriverWait wait = new WebDriverWait(driver, 30);
  35. wait.until(ExpectedConditions.visibilityOf(element));
  36. }
  37.  
  38. protected void setTextAs(WebElement element, String text){
  39. waitForElementClickable(element);
  40. element.sendKeys(text);
  41. }
  42.  
  43. protected void clickElement(WebElement element){
  44. waitForElementClickable(element);
  45. element.click();
  46. }
  47.  
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement