1
- using System ;
2
- using System . Collections . Generic ;
3
- using System . Drawing ;
4
- using OpenQA . Selenium ;
5
- using Aquality . Selenium . Core . Elements ;
6
- using Aquality . Selenium . Core . Logging ;
1
+ using System . Drawing ;
7
2
using Aquality . Selenium . Browsers ;
3
+ using Aquality . Selenium . Core . Logging ;
4
+ using Aquality . Selenium . Core . Forms ;
8
5
using Aquality . Selenium . Elements . Interfaces ;
6
+ using OpenQA . Selenium ;
9
7
using IElementStateProvider = Aquality . Selenium . Core . Elements . Interfaces . IElementStateProvider ;
8
+ using Aquality . Selenium . Core . Configurations ;
9
+ using Aquality . Selenium . Core . Localization ;
10
+ using Aquality . Selenium . Core . Waitings ;
10
11
11
12
namespace Aquality . Selenium . Forms
12
13
{
13
14
/// <summary>
14
15
/// Defines base class for any UI form.
15
16
/// </summary>
16
- public abstract class Form
17
+ public abstract class Form : Form < IElement >
17
18
{
18
19
private readonly ILabel formLabel ;
19
20
/// <summary>
@@ -39,6 +40,21 @@ protected Form(By locator, string name)
39
40
/// </summary>
40
41
protected static Logger Logger => AqualityServices . Logger ;
41
42
43
+ /// <summary>
44
+ /// Visualization configuration used by <see cref="Form{T}.Dump"/>.
45
+ /// </summary>
46
+ protected override IVisualizationConfiguration VisualizationConfiguration => AqualityServices . Get < IVisualizationConfiguration > ( ) ;
47
+
48
+ /// <summary>
49
+ /// Localized logger used by <see cref="Form{T}.Dump"/>.
50
+ /// </summary>
51
+ protected override ILocalizedLogger LocalizedLogger => AqualityServices . LocalizedLogger ;
52
+
53
+ /// <summary>
54
+ /// Conditional wait <see cref="IConditionalWait"/>
55
+ /// </summary>
56
+ protected static IConditionalWait ConditionalWait => AqualityServices . ConditionalWait ;
57
+
42
58
/// <summary>
43
59
/// Element factory <see cref="IElementFactory"/>
44
60
/// </summary>
@@ -52,15 +68,7 @@ protected Form(By locator, string name)
52
68
/// <summary>
53
69
/// Name of the form.
54
70
/// </summary>
55
- public string Name { get ; }
56
-
57
- /// <summary>
58
- /// Return form state for form locator
59
- /// </summary>
60
- /// <value>True - form is opened,
61
- /// False - form is not opened.</value>
62
- [ Obsolete ( "This property will be removed in the future release. Use State.WaitForDisplayed() if needed" ) ]
63
- public bool IsDisplayed => FormElement . State . WaitForDisplayed ( ) ;
71
+ public override string Name { get ; }
64
72
65
73
/// <summary>
66
74
/// Provides ability to get form's state (whether it is displayed, exists or not) and respective waiting functions.
@@ -70,7 +78,7 @@ protected Form(By locator, string name)
70
78
/// <summary>
71
79
/// Gets size of form element defined by its locator.
72
80
/// </summary>
73
- public Size Size => FormElement . GetElement ( ) . Size ;
81
+ public Size Size => FormElement . Visual . Size ;
74
82
75
83
/// <summary>
76
84
/// Scroll form without scrolling entire page
@@ -81,38 +89,5 @@ public void ScrollBy(int x, int y)
81
89
{
82
90
FormElement . JsActions . ScrollBy ( x , y ) ;
83
91
}
84
-
85
- /// <summary>
86
- /// Finds child element of current form by its locator.
87
- /// </summary>
88
- /// <typeparam name="T">Type of child element that has to implement IElement.</typeparam>
89
- /// <param name="childLocator">Locator of child element relative to form.</param>
90
- /// <param name="name">Child element name.</param>
91
- /// <param name="supplier">Delegate that defines constructor of child element in case of custom element.</param>
92
- /// <param name="state">Child element state.</param>
93
- /// <returns>Instance of child element.</returns>
94
- [ Obsolete ( "This method will be removed in the future release. Use FormElement property methods to find child element" ) ]
95
- protected T FindChildElement < T > ( By childLocator , string name = null , ElementSupplier < T > supplier = null , ElementState state = ElementState . Displayed )
96
- where T : IElement
97
- {
98
- return FormElement . FindChildElement ( childLocator , name , supplier , state ) ;
99
- }
100
-
101
- /// <summary>
102
- /// Finds child elements of current form by their locator.
103
- /// </summary>
104
- /// <typeparam name="T">Type of child elements that has to implement IElement.</typeparam>
105
- /// <param name="childLocator">Locator of child elements relative to form.</param>
106
- /// <param name="name">Child elements name.</param>
107
- /// <param name="supplier">Delegate that defines constructor of child element in case of custom element type.</param>
108
- /// <param name="expectedCount">Expected number of elements that have to be found (zero, more then zero, any).</param>
109
- /// <param name="state">Child elements state.</param>
110
- /// <returns>List of child elements.</returns>
111
- [ Obsolete ( "This method will be removed in the future release. Use FormElement property methods to find child elements" ) ]
112
- protected IList < T > FindChildElements < T > ( By childLocator , string name = null , ElementSupplier < T > supplier = null , ElementsCount expectedCount = ElementsCount . Any , ElementState state = ElementState . Displayed )
113
- where T : IElement
114
- {
115
- return FormElement . FindChildElements ( childLocator , name , supplier , expectedCount , state ) ;
116
- }
117
92
}
118
93
}
0 commit comments