From da03000bd6a406631f6a320575d824194549223e Mon Sep 17 00:00:00 2001 From: Christian Sciberras Date: Sat, 11 Jan 2025 22:21:51 +0100 Subject: [PATCH] Fix D&D on Selenium 3 --- src/Selenium2Driver.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php index fe8b1650..f8cbb966 100755 --- a/src/Selenium2Driver.php +++ b/src/Selenium2Driver.php @@ -1008,33 +1008,31 @@ public function dragTo(string $sourceXpath, string $destinationXpath) )); $script = <<executeJsOnElement($source, $script); - $this->getWebDriverSession()->buttondown(); - if ($destination->getID() !== $source->getID()) { + if ($destination->getID() === $source->getID()) { + $this->getWebDriverSession()->click(0); + } else { + $this->getWebDriverSession()->buttondown(); $this->getWebDriverSession()->moveto(array( 'element' => $destination->getID() )); + $this->getWebDriverSession()->buttonup(); } - $this->getWebDriverSession()->buttonup(); $script = <<executeJsOnElement($destination, $script);