1
|
/**
|
2
|
* Copyright (C) 2019 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.dataportal.elements;
|
10
|
|
11
|
import java.util.List;
|
12
|
|
13
|
import org.openqa.selenium.By;
|
14
|
import org.openqa.selenium.WebElement;
|
15
|
|
16
|
/**
|
17
|
* @author a.kohlbecker
|
18
|
* @since Feb 4, 2019
|
19
|
*
|
20
|
*/
|
21
|
abstract public class RegistrationItem extends BaseElement {
|
22
|
|
23
|
enum Style {
|
24
|
/**
|
25
|
* style produced by modules/cdm_dataportal/includes/name.inc#compose_registration_dto_full()
|
26
|
*/
|
27
|
FULL,
|
28
|
/**
|
29
|
* style produced by modules/cdm_dataportal/includes/name.inc#compose_registration_dto_compact()
|
30
|
*/
|
31
|
COMPACT
|
32
|
}
|
33
|
|
34
|
protected Style style = null;
|
35
|
protected List<WebElement> specimenTypeDesignations;
|
36
|
protected List<WebElement> nameTypeDesignations;
|
37
|
protected WebElement citation;
|
38
|
protected WebElement metadata;
|
39
|
protected WebElement identifier;
|
40
|
protected WebElement nameElement;
|
41
|
protected WebElement summaryElement;
|
42
|
|
43
|
/**"
|
44
|
* @param element
|
45
|
*/
|
46
|
protected RegistrationItem(WebElement containerElement) {
|
47
|
super(containerElement);
|
48
|
|
49
|
try {
|
50
|
summaryElement = containerElement.findElement(By.cssSelector(".registration-summary"));
|
51
|
style = Style.COMPACT;
|
52
|
identifier = containerElement.findElement(By.cssSelector(".identifier"));
|
53
|
} catch (Exception e) {
|
54
|
logger.debug("web element .registration-summary not found, now trying full style elements");
|
55
|
}
|
56
|
|
57
|
if(style == null){
|
58
|
try {
|
59
|
nameElement = containerElement.findElement(By.cssSelector(".name"));
|
60
|
} catch (Exception e) { /* IGNORE */}
|
61
|
try{
|
62
|
specimenTypeDesignations = containerElement.findElements(By.cssSelector(".specimen_type_designation"));
|
63
|
} catch (Exception e) { /* IGNORE */}
|
64
|
try {
|
65
|
nameTypeDesignations = containerElement.findElements(By.cssSelector(".name_type_designation"));
|
66
|
} catch (Exception e) { /* IGNORE */}
|
67
|
try {
|
68
|
citation = containerElement.findElement(By.cssSelector(".citation"));
|
69
|
style = Style.FULL;
|
70
|
} catch (Exception e) { /* IGNORE */}
|
71
|
|
72
|
|
73
|
}
|
74
|
// now the general elements which must exist
|
75
|
metadata = containerElement.findElement(By.cssSelector(".registration-date-and-institute"));
|
76
|
}
|
77
|
|
78
|
|
79
|
public Style getStyle() {
|
80
|
return style;
|
81
|
}
|
82
|
|
83
|
public WebElement getMetadata() {
|
84
|
return metadata;
|
85
|
}
|
86
|
|
87
|
public WebElement getIdentifier() {
|
88
|
return identifier;
|
89
|
}
|
90
|
|
91
|
|
92
|
|
93
|
}
|