@@ -209,6 +209,19 @@ public TouchAction longPress(WebElement el) {
209
209
return this ;
210
210
}
211
211
212
+ /**
213
+ * Press and hold the at the center of an element until the contextmenu event has fired.
214
+ * @param el element to long-press
215
+ * @param duration of the long-press, in milliseconds
216
+ * @return this TouchAction, for chaining
217
+ */
218
+ public TouchAction longPress (WebElement el , int duration ) {
219
+ ActionParameter action = new ActionParameter ("longPress" , (RemoteWebElement )el );
220
+ action .addParameter ("duration" , duration );
221
+ parameterBuilder .add (action );
222
+ return this ;
223
+ }
224
+
212
225
/**
213
226
* Press and hold the at an absolute position on the screen until the contextmenu event has fired.
214
227
* @param x x coordinate
@@ -223,6 +236,22 @@ public TouchAction longPress(int x, int y) {
223
236
return this ;
224
237
}
225
238
239
+ /**
240
+ * Press and hold the at an absolute position on the screen until the contextmenu event has fired.
241
+ * @param x x coordinate
242
+ * @param y y coordinate
243
+ * @param duration of the long-press, in milliseconds
244
+ * @return this TouchAction, for chaining
245
+ */
246
+ public TouchAction longPress (int x , int y , int duration ) {
247
+ ActionParameter action = new ActionParameter ("longPress" );
248
+ action .addParameter ("x" , x );
249
+ action .addParameter ("y" , y );
250
+ action .addParameter ("duration" , duration );
251
+ parameterBuilder .add (action );
252
+ return this ;
253
+ }
254
+
226
255
/**
227
256
* Press and hold the at an elements upper-left corner, offset by the given amount, until the contextmenu event has fired.
228
257
* @param el element to long-press
@@ -238,6 +267,23 @@ public TouchAction longPress(WebElement el, int x, int y) {
238
267
return this ;
239
268
}
240
269
270
+ /**
271
+ * Press and hold the at an elements upper-left corner, offset by the given amount, until the contextmenu event has fired.
272
+ * @param el element to long-press
273
+ * @param x x offset
274
+ * @param y y offset
275
+ * @param duration of the long-press, in milliseconds
276
+ * @return this TouchAction, for chaining
277
+ */
278
+ public TouchAction longPress (WebElement el , int x , int y , int duration ) {
279
+ ActionParameter action = new ActionParameter ("longPress" , (RemoteWebElement )el );
280
+ action .addParameter ("x" , x );
281
+ action .addParameter ("y" , y );
282
+ action .addParameter ("duration" , duration );
283
+ parameterBuilder .add (action );
284
+ return this ;
285
+ }
286
+
241
287
/**
242
288
* Cancel this action, if it was partially completed by the driver
243
289
*/
0 commit comments