Project

General

Profile

Download (1 KB) Statistics
| Branch: | Tag: | Revision:
1
package eu.etaxonomy.dataportal.elements;
2

    
3
import java.net.MalformedURLException;
4
import java.net.URL;
5

    
6
import org.openqa.selenium.Dimension;
7
import org.openqa.selenium.WebElement;
8

    
9
public class ImgElement extends BaseElement {
10

    
11
	private URL url = null;
12
	private Dimension dimension = null;
13
	private String altText = null;
14

    
15
	public ImgElement(WebElement img) {
16

    
17
		super(img);
18

    
19
		// read src url
20
		if (img.getAttribute("src") != null) {
21
			try {
22
				setUrl(new URL(img.getAttribute("src")));
23
			} catch (MalformedURLException e) {
24
				// IGNORE //
25
			}
26
		}
27

    
28
		// read rendered width & height
29
		setDimension(img.getSize());
30

    
31
		setAltText(img.getAttribute("alt"));
32
	}
33

    
34
	public void setUrl(URL url) {
35
		this.url = url;
36
	}
37

    
38
	public URL getUrl() {
39
		return url;
40
	}
41

    
42
	public void setDimension(Dimension dimension) {
43
		this.dimension = dimension;
44
	}
45

    
46
	public Dimension getDimension() {
47
		return dimension;
48
	}
49

    
50
	public void setAltText(String altText) {
51
		this.altText = altText;
52
	}
53

    
54
	public String getAltText() {
55
		return altText;
56
	}
57

    
58

    
59
}
(6-6/10)