@@ -401,9 +401,10 @@ public void pinch(WebElement el) {
401401 Dimension dimensions = el .getSize ();
402402 Point upperLeft = el .getLocation ();
403403 Point center = new Point (upperLeft .getX () + dimensions .getWidth () / 2 , upperLeft .getY () + dimensions .getHeight () / 2 );
404+ int yOffset = center .getY () - upperLeft .getY ();
404405
405- TouchAction action0 = new TouchAction (this ).press (el , center .getX (), center .getY () - 100 ).moveTo (el ).release ();
406- TouchAction action1 = new TouchAction (this ).press (el , center .getX (), center .getY () + 100 ).moveTo (el ).release ();
406+ TouchAction action0 = new TouchAction (this ).press (el , center .getX (), center .getY () - yOffset ).moveTo (el ).release ();
407+ TouchAction action1 = new TouchAction (this ).press (el , center .getX (), center .getY () + yOffset ).moveTo (el ).release ();
407408
408409 multiTouch .add (action0 ).add (action1 );
409410
@@ -448,9 +449,10 @@ public void zoom(WebElement el) {
448449 Dimension dimensions = el .getSize ();
449450 Point upperLeft = el .getLocation ();
450451 Point center = new Point (upperLeft .getX () + dimensions .getWidth () / 2 , upperLeft .getY () + dimensions .getHeight () / 2 );
452+ int yOffset = center .getY () - upperLeft .getY ();
451453
452- TouchAction action0 = new TouchAction (this ).press (el ).moveTo (el , center .getX (), center .getY () - 100 ).release ();
453- TouchAction action1 = new TouchAction (this ).press (el ).moveTo (el , center .getX (), center .getY () + 100 ).release ();
454+ TouchAction action0 = new TouchAction (this ).press (el ).moveTo (el , center .getX (), center .getY () - yOffset ).release ();
455+ TouchAction action1 = new TouchAction (this ).press (el ).moveTo (el , center .getX (), center .getY () + yOffset ).release ();
454456
455457 multiTouch .add (action0 ).add (action1 );
456458
0 commit comments