@@ -209,6 +209,19 @@ public TouchAction longPress(WebElement el) {
209209 return this ;
210210 }
211211
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+
212225 /**
213226 * Press and hold the at an absolute position on the screen until the contextmenu event has fired.
214227 * @param x x coordinate
@@ -223,6 +236,22 @@ public TouchAction longPress(int x, int y) {
223236 return this ;
224237 }
225238
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+
226255 /**
227256 * Press and hold the at an elements upper-left corner, offset by the given amount, until the contextmenu event has fired.
228257 * @param el element to long-press
@@ -238,6 +267,23 @@ public TouchAction longPress(WebElement el, int x, int y) {
238267 return this ;
239268 }
240269
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+
241287 /**
242288 * Cancel this action, if it was partially completed by the driver
243289 */
0 commit comments