1
|
// $Id$
|
2
|
|
3
|
/**
|
4
|
* Copyright (C) 2009 EDIT
|
5
|
* European Distributed Institute of Taxonomy
|
6
|
* http://www.e-taxonomy.eu
|
7
|
*
|
8
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
9
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
10
|
*/
|
11
|
package eu.etaxonomy.dataportal.pages;
|
12
|
|
13
|
import java.net.MalformedURLException;
|
14
|
|
15
|
import org.apache.log4j.Logger;
|
16
|
import org.openqa.selenium.By;
|
17
|
import org.openqa.selenium.NoSuchElementException;
|
18
|
import org.openqa.selenium.RenderedWebElement;
|
19
|
import org.openqa.selenium.WebDriver;
|
20
|
import org.openqa.selenium.support.CacheLookup;
|
21
|
import org.openqa.selenium.support.FindBy;
|
22
|
|
23
|
import eu.etaxonomy.dataportal.elements.ImgElement;
|
24
|
|
25
|
/**
|
26
|
* @author andreas
|
27
|
* @date Jul 1, 2011
|
28
|
*
|
29
|
*/
|
30
|
public class TaxonProfilePage extends PortalPage {
|
31
|
|
32
|
public static final Logger logger = Logger.getLogger(TaxonProfilePage.class);
|
33
|
|
34
|
@FindBy(id = "taxonProfileImage")
|
35
|
@CacheLookup
|
36
|
private RenderedWebElement taxonProfileImage;
|
37
|
|
38
|
public TaxonProfilePage(WebDriver driver) throws MalformedURLException {
|
39
|
super(driver);
|
40
|
}
|
41
|
|
42
|
/**
|
43
|
* Returns the profile image of the taxon profile page. This image is
|
44
|
* located at the top of the page. The Profile Image can be disabled in the
|
45
|
* DataPortal settings.
|
46
|
*
|
47
|
* @return The Url of the profile image or null if the image is not visible.
|
48
|
*/
|
49
|
public ImgElement getProfileImage() {
|
50
|
ImgElement imgElement = null;
|
51
|
try {
|
52
|
if(taxonProfileImage.isDisplayed()){
|
53
|
RenderedWebElement img = (RenderedWebElement) taxonProfileImage.findElement(By.tagName("img"));
|
54
|
if (img != null) {
|
55
|
imgElement = new ImgElement(img);
|
56
|
}
|
57
|
}
|
58
|
} catch (NoSuchElementException e) {
|
59
|
// IGNORE //
|
60
|
}
|
61
|
return imgElement;
|
62
|
}
|
63
|
}
|