-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerformableBuilder.elementPerformables.cs
More file actions
164 lines (153 loc) · 8.92 KB
/
Copy pathPerformableBuilder.elementPerformables.cs
File metadata and controls
164 lines (153 loc) · 8.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
using System;
using CSF.Screenplay.Selenium.Actions;
using CSF.Screenplay.Selenium.Builders;
using CSF.Screenplay.Selenium.Elements;
namespace CSF.Screenplay.Selenium
{
public static partial class PerformableBuilder
{
/// <summary>
/// Gets a performable action which represents an actor clicking on a specified target element.
/// </summary>
/// <param name="target">The target element on which to click.</param>
/// <returns>A performable action</returns>
public static ClickBuilder ClickOn(ITarget target) => new ClickBuilder(target);
/// <summary>
/// Gets a builder for creating a performable action which represents an actor typing text into a target element.
/// </summary>
/// <remarks>
/// <para>
/// This may be used to send more than normal/printable text to the specified element. Special/nonprintable keys may be sent by
/// using the <c>OpenQA.Selenium.Keys</c> class.
/// </para>
/// <para>
/// For convenience, especially when using the Selenium <c>Keys</c> class mentioned above, this method accepts a <c>params</c> array
/// of strings. If an array of strings is passed, they will be concatenated together before being sent to the element as a single string.
/// The array/params syntax is used to allow a consumer to pass multiple strings (perhaps each only one character) as a single argument,
/// without needing to manually concatenate them.
/// </para>
/// </remarks>
/// <param name="text">The text/keys for the actor to type.</param>
/// <returns>A builder with which the user may select a target element.</returns>
public static SendKeysBuilder EnterTheText(params string[] text) => new SendKeysBuilder(string.Join(string.Empty, text));
/// <summary>
/// Gets a builder for creating a performable action which represents an actor entering a date into an <c><input type="date"></c> element.
/// </summary>
/// <remarks>
/// <para>
/// If the specified <paramref name="date"/> is <see langword="null"/> then the input element will be cleared.
/// </para>
/// </remarks>
/// <param name="date">The date to enter into the input control.</param>
/// <returns>A builder with which the user may select a target element and optionally a culture.</returns>
public static EnterTheDateBuilder EnterTheDate(DateTime? date) => new EnterTheDateBuilder(date);
/// <summary>
/// Gets a performable which represents an actor deselecting everything from a <c><select></c> element.
/// </summary>
/// <remarks>
/// <para>
/// As might be expected, the <paramref name="target"/> parameter must represent a <c><select></c> element or the resulting
/// performable will raise an exception.
/// </para>
/// </remarks>
/// <param name="target">A target which represents an HTML <c><select></c> element</param>
/// <returns>A performable action</returns>
public static IPerformable DeselectEverythingFrom(ITarget target) => SingleElementPerformableAdapter.From(new DeselectAll(), target);
/// <summary>
/// Gets a builder which will create a performable which represents an actor deselecting a specified option from a
/// <c><select></c> element.
/// </summary>
/// <remarks>
/// <para>
/// This overload deselects the option by its zero-based index.
/// As might be expected, the target which is specified in the builder must represent a <c><select></c> element or the resulting
/// performable will raise an exception.
/// </para>
/// </remarks>
/// <param name="optionIndex">The zero-based index of an option to deselect</param>
/// <returns>A builder by which a target element is chosen</returns>
public static FromTargetActionBuilder DeselectTheOption(int optionIndex)
=> new FromTargetActionBuilder(new DeselectByIndex(optionIndex));
/// <summary>
/// Gets a builder which will create a performable which represents an actor deselecting a specified option from a
/// <c><select></c> element.
/// </summary>
/// <remarks>
/// <para>
/// This overload deselects the option by its displayed text.
/// As might be expected, the target which is specified in the builder must represent a <c><select></c> element or the resulting
/// performable will raise an exception.
/// </para>
/// </remarks>
/// <param name="optionText">The text of the option to deselect</param>
/// <returns>A builder by which a target element is chosen</returns>
public static FromTargetActionBuilder DeselectTheOption(string optionText)
=> new FromTargetActionBuilder(new DeselectByText(optionText));
/// <summary>
/// Gets a builder which will create a performable which represents an actor deselecting a specified option from a
/// <c><select></c> element.
/// </summary>
/// <remarks>
/// <para>
/// This overload deselects the option by its underlying <c>value</c> attribute, instead of its displayed text.
/// As might be expected, the target which is specified in the builder must represent a <c><select></c> element or the resulting
/// performable will raise an exception.
/// </para>
/// </remarks>
/// <param name="optionValue">The underlying value of the option to deselect</param>
/// <returns>A builder by which a target element is chosen</returns>
public static FromTargetActionBuilder DeselectTheOptionWithValue(string optionValue)
=> new FromTargetActionBuilder(new DeselectByValue(optionValue));
/// <summary>
/// Gets a builder which will create a performable which represents an actor selecting a specified option from a
/// <c><select></c> element.
/// </summary>
/// <remarks>
/// <para>
/// This overload selects the option by its zero-based index.
/// As might be expected, the target which is specified in the builder must represent a <c><select></c> element or the resulting
/// performable will raise an exception.
/// </para>
/// </remarks>
/// <param name="optionIndex">The zero-based index of an option to select</param>
/// <returns>A builder by which a target element is chosen</returns>
public static FromTargetActionBuilder SelectTheOption(int optionIndex)
=> new FromTargetActionBuilder(new SelectByIndex(optionIndex));
/// <summary>
/// Gets a builder which will create a performable which represents an actor selecting a specified option from a
/// <c><select></c> element.
/// </summary>
/// <remarks>
/// <para>
/// This overload selects the option by its displayed text.
/// As might be expected, the target which is specified in the builder must represent a <c><select></c> element or the resulting
/// performable will raise an exception.
/// </para>
/// </remarks>
/// <param name="optionText">The text of the option to select</param>
/// <returns>A builder by which a target element is chosen</returns>
public static FromTargetActionBuilder SelectTheOption(string optionText)
=> new FromTargetActionBuilder(new SelectByText(optionText));
/// <summary>
/// Gets a builder which will create a performable which represents an actor selecting a specified option from a
/// <c><select></c> element.
/// </summary>
/// <remarks>
/// <para>
/// This overload selects the option by its underlying <c>value</c> attribute, instead of its displayed text.
/// As might be expected, the target which is specified in the builder must represent a <c><select></c> element or the resulting
/// performable will raise an exception.
/// </para>
/// </remarks>
/// <param name="optionValue">The underlying value of the option to select</param>
/// <returns>A builder by which a target element is chosen</returns>
public static FromTargetActionBuilder SelectTheOptionWithValue(string optionValue)
=> new FromTargetActionBuilder(new SelectByValue(optionValue));
/// <summary>
/// Gets a performable action which clears the contents of the specified target element.
/// </summary>
/// <param name="target">The target element whose contents will be cleared.</param>
/// <returns>A performable action</returns>
public static IPerformable ClearTheContentsOf(ITarget target) => SingleElementPerformableAdapter.From(new ClearTheContents(), target);
}
}