1
1
package aquality .selenium .forms ;
2
2
3
3
import aquality .selenium .browser .AqualityServices ;
4
+ import aquality .selenium .core .configurations .IVisualizationConfiguration ;
4
5
import aquality .selenium .core .elements .interfaces .IElementStateProvider ;
5
6
import aquality .selenium .core .localization .ILocalizedLogger ;
7
+ import aquality .selenium .elements .interfaces .IElement ;
6
8
import aquality .selenium .elements .interfaces .IElementFactory ;
7
9
import aquality .selenium .elements .interfaces .ILabel ;
8
10
import org .openqa .selenium .By ;
9
- import org .openqa .selenium .Dimension ;
11
+
12
+ import java .awt .*;
10
13
11
14
/**
12
15
* Defines base class for any UI form.
13
16
*/
14
- public abstract class Form {
17
+ public abstract class Form extends aquality .selenium .core .forms .Form <IElement > {
18
+ /**
19
+ * Label of form element defined by its locator and name.
20
+ */
21
+ private final ILabel formLabel ;
15
22
/**
16
23
* Locator for specified form
17
24
*/
@@ -25,8 +32,10 @@ public abstract class Form {
25
32
* Constructor with parameters
26
33
*/
27
34
protected Form (By locator , String name ) {
35
+ super (IElement .class );
28
36
this .locator = locator ;
29
37
this .name = name ;
38
+ formLabel = getElementFactory ().getLabel (locator , name );
30
39
}
31
40
32
41
/**
@@ -83,7 +92,7 @@ public void scrollBy(int x, int y) {
83
92
* @return Size of the form element.
84
93
*/
85
94
public Dimension getSize () {
86
- return getFormLabel ().getElement ().getSize ();
95
+ return getFormLabel ().visual ().getSize ();
87
96
}
88
97
89
98
@@ -94,7 +103,7 @@ public Dimension getSize() {
94
103
* @return Label of form element.
95
104
*/
96
105
protected ILabel getFormLabel () {
97
- return getElementFactory (). getLabel ( locator , name ) ;
106
+ return formLabel ;
98
107
}
99
108
100
109
/**
@@ -111,7 +120,18 @@ protected IElementFactory getElementFactory() {
111
120
*
112
121
* @return instance of localized logger.
113
122
*/
114
- protected ILocalizedLogger getLogger () {
123
+ @ Override
124
+ protected ILocalizedLogger getLocalizedLogger () {
115
125
return AqualityServices .getLocalizedLogger ();
116
126
}
127
+
128
+ /**
129
+ * Visualization configuration used by dump().
130
+ *
131
+ * @return instance of visualization configuration.
132
+ */
133
+ @ Override
134
+ protected IVisualizationConfiguration getVisualizationConfiguration () {
135
+ return AqualityServices .getConfiguration ().getVisualizationConfiguration ();
136
+ }
117
137
}
0 commit comments