1818
1919import static com .google .common .base .Preconditions .checkNotNull ;
2020import static com .google .common .collect .ImmutableList .builder ;
21- import static io .appium .java_client .touch .LongPressOptions .longPressOptions ;
22- import static io .appium .java_client .touch .offset .ElementOption .element ;
23- import static io .appium .java_client .touch .offset .PointOption .point ;
2421import static java .util .stream .Collectors .toList ;
2522
2623import com .google .common .collect .ImmutableList ;
3229import io .appium .java_client .touch .WaitOptions ;
3330import io .appium .java_client .touch .offset .ElementOption ;
3431import io .appium .java_client .touch .offset .PointOption ;
35- import org .openqa .selenium .WebElement ;
3632
37- import java .time .Duration ;
3833import java .util .List ;
3934import java .util .Map ;
4035
@@ -70,45 +65,6 @@ public T press(PointOption pressOptions) {
7065 return (T ) this ;
7166 }
7267
73- /**
74- * Press on the center of an element.
75- *
76- * @param el element to press on.
77- * @return this TouchAction, for chaining.
78- * @deprecated use {@link #press(PointOption)} instead
79- */
80- @ Deprecated
81- public T press (WebElement el ) {
82- return press (element (el ));
83- }
84-
85- /**
86- * Press on an absolute position on the screen.
87- *
88- * @param x x coordinate.
89- * @param y y coordinate.
90- * @return this TouchAction, for chaining.
91- * @deprecated use {@link #press(PointOption)} instead
92- */
93- @ Deprecated
94- public T press (int x , int y ) {
95- return press (point (x , y ));
96- }
97-
98- /**
99- * Press on an element, offset from upper left corner by a number of pixels.
100- *
101- * @param el element to press on.
102- * @param x x offset.
103- * @param y y offset.
104- * @return this TouchAction, for chaining.
105- * @deprecated use {@link #press(PointOption)} instead
106- */
107- @ Deprecated
108- public T press (WebElement el , int x , int y ) {
109- return press (element (el , x , y ));
110- }
111-
11268 /**
11369 * Remove the current touching implement from the screen (withdraw your touch).
11470 *
@@ -138,47 +94,6 @@ public T moveTo(PointOption moveToOptions) {
13894 return (T ) this ;
13995 }
14096
141- /**
142- * Move current touch to center of an element.
143- *
144- * @param el element to move to.
145- * @return this TouchAction, for chaining.
146- * @deprecated {@link #moveTo(PointOption)} instead
147- */
148- @ Deprecated
149- public T moveTo (WebElement el ) {
150- return moveTo (element (el ));
151- }
152-
153- /**
154- * Move current touch to a new position relative to the current position on
155- * the screen. If the current position of this TouchAction is (xOld, yOld),
156- * then this method will move the TouchAction to (xOld + x, yOld + y).
157- *
158- * @param x change in x coordinate to move through.
159- * @param y change in y coordinate to move through.
160- * @return this TouchAction, for chaining.
161- * @deprecated {@link #moveTo(PointOption)} instead
162- */
163- @ Deprecated
164- public T moveTo (int x , int y ) {
165- return moveTo (point (x , y ));
166- }
167-
168- /**
169- * Move current touch to an element, offset from upper left corner.
170- *
171- * @param el element to move current touch to.
172- * @param x x offset.
173- * @param y y offset.
174- * @return this TouchAction, for chaining.
175- * @deprecated {@link #moveTo(PointOption)} instead
176- */
177- @ Deprecated
178- public T moveTo (WebElement el , int x , int y ) {
179- return moveTo (element (el , x , y ));
180- }
181-
18297 /**
18398 * Tap on an element.
18499 *
@@ -203,45 +118,6 @@ public T tap(PointOption tapOptions) {
203118 return (T ) this ;
204119 }
205120
206- /**
207- * Tap the center of an element.
208- *
209- * @param el element to tap.
210- * @return this TouchAction, for chaining.
211- * @deprecated use {@link #tap(PointOption)} instead.
212- */
213- @ Deprecated
214- public T tap (WebElement el ) {
215- return tap (element (el ));
216- }
217-
218- /**
219- * Tap an absolute position on the screen.
220- *
221- * @param x x coordinate.
222- * @param y y coordinate.
223- * @return this TouchAction, for chaining.
224- * @deprecated use {@link #tap(PointOption)} instead.
225- */
226- @ Deprecated
227- public T tap (int x , int y ) {
228- return tap (point (x , y ));
229- }
230-
231- /**
232- * Tap an element, offset from upper left corner.
233- *
234- * @param el element to tap.
235- * @param x x offset.
236- * @param y y offset.
237- * @return this TouchAction, for chaining.
238- * @deprecated use {@link #tap(PointOption)} instead.
239- */
240- @ Deprecated
241- public T tap (WebElement el , int x , int y ) {
242- return tap (element (el , x , y ));
243- }
244-
245121 /**
246122 * A wait action, used as a NOP in multi-chaining.
247123 *
@@ -267,23 +143,6 @@ public T waitAction(WaitOptions waitOptions) {
267143 return (T ) this ;
268144 }
269145
270- /**
271- * Waits for specified amount of time to pass before continue to next touch action.
272- *
273- * @param duration of the wait action. Minimum time reolution unit is one millisecond.
274- * @return this TouchAction, for chaining.
275- * @deprecated use {@link #waitAction(WaitOptions)} instead.
276- */
277- @ Deprecated
278- public T waitAction (Duration duration ) {
279- ActionParameter action = new ActionParameter ("wait" ,
280- new WaitOptions ()
281- .withDuration (duration ));
282- parameterBuilder .add (action );
283- //noinspection unchecked
284- return (T ) this ;
285- }
286-
287146 /**
288147 * Press and hold the at the center of an element until the context menu event has fired.
289148 *
@@ -310,94 +169,6 @@ public T longPress(PointOption longPressOptions) {
310169 return (T ) this ;
311170 }
312171
313- /**
314- * Press and hold the at the center of an element until the contextmenu event has fired.
315- *
316- * @param el element to long-press.
317- * @return this TouchAction, for chaining.
318- * @deprecated use {@link #longPress(PointOption)} instead
319- */
320- @ Deprecated
321- public T longPress (WebElement el ) {
322- return longPress (element (el ));
323- }
324-
325- /**
326- * Press and hold the at the center of an element until the contextmenu event has fired.
327- *
328- * @param el element to long-press.
329- * @param duration of the long-press. Minimum time resolution unit is one millisecond.
330- * @return this TouchAction, for chaining.
331- * @deprecated use {@link #longPress(LongPressOptions)} instead
332- */
333- @ Deprecated
334- public T longPress (WebElement el , Duration duration ) {
335- return longPress (longPressOptions ()
336- .withDuration (duration ).withElement (element (el )));
337- }
338-
339- /**
340- * Press and hold the at an absolute position on the screen
341- * until the contextmenu event has fired.
342- *
343- * @param x x coordinate.
344- * @param y y coordinate.
345- * @return this TouchAction, for chaining.
346- * @deprecated use {@link #longPress(PointOption)} instead
347- */
348- @ Deprecated
349- public T longPress (int x , int y ) {
350- return longPress (point (x , y ));
351- }
352-
353- /**
354- * Press and hold the at an absolute position on the screen until the
355- * contextmenu event has fired.
356- *
357- * @param x x coordinate.
358- * @param y y coordinate.
359- * @param duration of the long-press. Minimum time resolution unit is one millisecond.
360- * @return this TouchAction, for chaining.
361- * @deprecated use {@link #longPress(LongPressOptions)} instead
362- */
363- @ Deprecated
364- public T longPress (int x , int y , Duration duration ) {
365- return longPress (longPressOptions ()
366- .withDuration (duration ).withPosition (point (x , y )));
367- }
368-
369- /**
370- * Press and hold the at an elements upper-left corner, offset by the given amount,
371- * until the contextmenu event has fired.
372- *
373- * @param el element to long-press.
374- * @param x x offset.
375- * @param y y offset.
376- * @return this TouchAction, for chaining.
377- * @deprecated use {@link #longPress(PointOption)} instead
378- */
379- @ Deprecated
380- public T longPress (WebElement el , int x , int y ) {
381- return longPress (element (el , x , y ));
382- }
383-
384- /**
385- * Press and hold the at an elements upper-left corner, offset by the
386- * given amount, until the contextmenu event has fired.
387- *
388- * @param el element to long-press.
389- * @param x x offset.
390- * @param y y offset.
391- * @param duration of the long-press. Minimum time resolution unit is one millisecond.
392- * @return this TouchAction, for chaining.
393- * @deprecated use {@link #longPress(LongPressOptions)} instead
394- */
395- @ Deprecated
396- public T longPress (WebElement el , int x , int y , Duration duration ) {
397- return longPress (longPressOptions ()
398- .withElement (element (el , x , y )).withDuration (duration ));
399- }
400-
401172 /**
402173 * Cancel this action, if it was partially completed by the performsTouchActions.
403174 */
0 commit comments