Project

General

Profile

Download (1.09 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 srcUrl = 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
				setSrcUrl(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 setSrcUrl(URL url) {
35
		this.srcUrl = url;
36
	}
37

    
38
	/**
39
	 * @return the image source URL from the src attribute
40
	 */
41
	public URL getSrcUrl() {
42
		return srcUrl;
43
	}
44

    
45
	public void setDimension(Dimension dimension) {
46
		this.dimension = dimension;
47
	}
48

    
49
	public Dimension getDimension() {
50
		return dimension;
51
	}
52

    
53
	public void setAltText(String altText) {
54
		this.altText = altText;
55
	}
56

    
57
	public String getAltText() {
58
		return altText;
59
	}
60

    
61

    
62
}
(9-9/21)