1 package org.kuali.student.lum.ui.selenium; 2 3 import org.openqa.selenium.WebDriver; 4 import org.openqa.selenium.support.ui.ExpectedCondition; 5 6 public class TitlePresentCondition implements ExpectedCondition<Boolean> { 7 String expectedTitle; 8 9 public TitlePresentCondition() { 10 this(null); 11 } 12 13 public TitlePresentCondition(String expectedTitle) { 14 super(); 15 this.expectedTitle = expectedTitle; 16 } 17 18 @Override 19 public Boolean apply(WebDriver d) { 20 String title = d.getTitle(); 21 if (title == null) { 22 return false; 23 } 24 if (expectedTitle == null) { 25 return false; 26 } 27 return title.trim().equalsIgnoreCase(expectedTitle.trim()); 28 } 29 30 public String getExpectedTitle() { 31 return expectedTitle; 32 } 33 34 public void setExpectedTitle(String expectedTitle) { 35 this.expectedTitle = expectedTitle; 36 } 37 38 }