From fff9d2679065bdfce5cc6e9d4e64563b426b58a5 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Wed, 31 Jul 2024 13:11:40 +0100 Subject: [PATCH] Reapply "Draging (which involves a click) also needs to scroll into view" This reverts commit 761ea2edb9add62febbe0fc392496a29f5ed2ac3. --- src/Selenium2Driver.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php index c40114a6..463479be 100755 --- a/src/Selenium2Driver.php +++ b/src/Selenium2Driver.php @@ -1023,6 +1023,7 @@ public function dragTo(string $sourceXpath, string $destinationXpath) $destination = $this->findElement($destinationXpath); if ($this->isW3C()) { + $this->scrollElementIntoView($source); $actions = array( 'actions' => [ [ @@ -1030,9 +1031,9 @@ public function dragTo(string $sourceXpath, string $destinationXpath) 'id' => 'mouse1', 'parameters' => ['pointerType' => 'mouse'], 'actions' => [ - ['type' => 'pointerMove', 'duration' => 0, 'origin' => [Element::WEB_ELEMENT_ID => $this->findElement($sourceXpath)->getID()], 'x' => 0, 'y' => 0], + ['type' => 'pointerMove', 'duration' => 0, 'origin' => [Element::WEB_ELEMENT_ID => $source->getID()], 'x' => 0, 'y' => 0], ['type' => 'pointerDown', "button" => 0], - ['type' => 'pointerMove', 'duration' => 0, 'origin' => [Element::WEB_ELEMENT_ID => $this->findElement($destinationXpath)->getID()], 'x' => 0, 'y' => 0], + ['type' => 'pointerMove', 'duration' => 0, 'origin' => [Element::WEB_ELEMENT_ID => $destination->getID()], 'x' => 0, 'y' => 0], ['type' => 'pointerUp', "button" => 0], ], ],