1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2011 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.dataportal.elements;
|
11
|
|
12
|
import java.util.Arrays;
|
13
|
import java.util.List;
|
14
|
|
15
|
import org.openqa.selenium.WebElement;
|
16
|
|
17
|
/**
|
18
|
* @author andreas
|
19
|
* @date Jul 1, 2011
|
20
|
*
|
21
|
*/
|
22
|
public class BaseElement {
|
23
|
|
24
|
|
25
|
private WebElement element;
|
26
|
|
27
|
private List<String> classAttributes = null;
|
28
|
|
29
|
private String text = null;
|
30
|
|
31
|
|
32
|
public WebElement getElement() {
|
33
|
return element;
|
34
|
}
|
35
|
|
36
|
public String getText() {
|
37
|
return text;
|
38
|
}
|
39
|
|
40
|
public void setText(String text) {
|
41
|
this.text = text;
|
42
|
}
|
43
|
|
44
|
public List<String> getClassAttributes() {
|
45
|
return classAttributes;
|
46
|
}
|
47
|
|
48
|
public void setClassAttributes(List<String> classAttributes) {
|
49
|
this.classAttributes = classAttributes;
|
50
|
}
|
51
|
|
52
|
/**
|
53
|
* @param element
|
54
|
*/
|
55
|
public BaseElement(WebElement element) {
|
56
|
|
57
|
this.element = element;
|
58
|
|
59
|
// read text
|
60
|
text = element.getText();
|
61
|
|
62
|
// read and tokenize the class attribute
|
63
|
if (element.getAttribute("class") != null) {
|
64
|
String[] classTokens = element.getAttribute("class").split("\\s");
|
65
|
setClassAttributes(Arrays.asList(classTokens));
|
66
|
}
|
67
|
}
|
68
|
|
69
|
|
70
|
}
|