Revision 14a1655f
Added by Andreas Kohlbecker almost 11 years ago
7.x/modules/cdm_dataportal/test/java/dataportal-selenium-tests/src/main/java/eu/etaxonomy/dataportal/selenium/PageTitleValidated.java | ||
---|---|---|
3 | 3 |
*/ |
4 | 4 |
package eu.etaxonomy.dataportal.selenium; |
5 | 5 |
|
6 |
import org.openqa.selenium.By; |
|
7 | 6 |
import org.openqa.selenium.WebDriver; |
8 | 7 |
|
9 | 8 |
import com.google.common.base.Function; |
... | ... | |
14 | 13 |
*/ |
15 | 14 |
public class PageTitleValidated implements Function<WebDriver, Boolean> { |
16 | 15 |
|
17 |
private String title;
|
|
16 |
private final String title;
|
|
18 | 17 |
|
19 |
public PageTitleValidated(String title) {
|
|
20 |
this.title = title;
|
|
21 |
}
|
|
18 |
public PageTitleValidated(String title) {
|
|
19 |
this.title = title;
|
|
20 |
}
|
|
22 | 21 |
|
23 |
/* (non-Javadoc) |
|
24 |
* @see com.google.common.base.Function#apply(java.lang.Object) |
|
25 |
*/ |
|
26 |
public Boolean apply(WebDriver driver) { |
|
27 |
boolean validated = driver.findElement(By.tagName("title")).getText().equals(title); |
|
28 |
return Boolean.valueOf(validated); |
|
29 |
} |
|
22 |
/* (non-Javadoc) |
|
23 |
* @see com.google.common.base.Function#apply(java.lang.Object) |
|
24 |
*/ |
|
25 |
@Override |
|
26 |
public Boolean apply(WebDriver driver) { |
|
27 |
boolean validated = driver.getTitle().equals(title); |
|
28 |
return Boolean.valueOf(validated); |
|
29 |
} |
|
30 | 30 |
|
31 | 31 |
} |
Also available in: Unified diff
adapting test framwork to changes in selenium api