@@ -745,23 +745,24 @@ public function _before(TestInterface $test)
745
745
*/
746
746
public function dragAndDrop ($ source , $ target , $ xOffset = null , $ yOffset = null )
747
747
{
748
- if ( $ xOffset !== null || $ yOffset !== null ) {
749
- $ snodes = $ this ->matchFirstOrFail ($ this ->baseElement , $ source );
750
- $ tnodes = $ this -> matchFirstOrFail ($ this ->baseElement , $ target );
748
+ $ snodes = $ this -> matchFirstOrFail ( $ this -> baseElement , $ source );
749
+ $ tnodes = $ this ->matchFirstOrFail ($ this ->baseElement , $ target );
750
+ $ action = new WebDriverActions ($ this ->webDriver );
751
751
752
+ if ($ xOffset !== null || $ yOffset !== null ) {
752
753
$ targetX = intval ($ tnodes ->getLocation ()->getX () + $ xOffset );
753
754
$ targetY = intval ($ tnodes ->getLocation ()->getY () + $ yOffset );
754
755
755
756
$ travelX = intval ($ targetX - $ snodes ->getLocation ()->getX ());
756
757
$ travelY = intval ($ targetY - $ snodes ->getLocation ()->getY ());
757
-
758
- $ action = new WebDriverActions ($ this ->webDriver );
759
- $ action ->moveToElement ($ snodes )->perform ();
760
- $ action ->clickAndHold ($ snodes )->perform ();
761
- $ action ->moveByOffset ($ travelX , $ travelY )->perform ();
758
+ $ action ->moveToElement ($ snodes );
759
+ $ action ->clickAndHold ($ snodes );
760
+ $ action ->moveByOffset ($ travelX , $ travelY );
762
761
$ action ->release ()->perform ();
763
762
} else {
764
- parent ::dragAndDrop ($ source , $ target );
763
+ $ action ->clickAndHold ($ snodes );
764
+ $ action ->moveToElement ($ tnodes );
765
+ $ action ->release ($ tnodes )->perform ();
765
766
}
766
767
}
767
768
0 commit comments