From ad0072edace5351f982fedf4167a38221ccbb09d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 17 Oct 2022 12:41:06 +0200 Subject: [PATCH 1/2] Selenium2Driver::dragTo() does not need syn.js --- src/Selenium2Driver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php index 917a4a47..a38885b4 100755 --- a/src/Selenium2Driver.php +++ b/src/Selenium2Driver.php @@ -978,7 +978,7 @@ public function dragTo(string $sourceXpath, string $destinationXpath) element.dispatchEvent(event); }({{ELEMENT}})); JS; - $this->withSyn()->executeJsOnElement($source, $script); + $this->executeJsOnElement($source, $script); $this->getWebDriverSession()->buttondown(); $this->getWebDriverSession()->moveto(array( @@ -996,7 +996,7 @@ public function dragTo(string $sourceXpath, string $destinationXpath) element.dispatchEvent(event); }({{ELEMENT}})); JS; - $this->withSyn()->executeJsOnElement($destination, $script); + $this->executeJsOnElement($destination, $script); } public function executeScript(string $script) From 696ed9495f9b8b92db8ca0e236b840b875e4b908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 17 Oct 2022 13:23:47 +0200 Subject: [PATCH 2/2] No WebDriver\Session::moveto() call when dragging over itself --- src/Selenium2Driver.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php index a38885b4..e74fcb3a 100755 --- a/src/Selenium2Driver.php +++ b/src/Selenium2Driver.php @@ -981,9 +981,11 @@ public function dragTo(string $sourceXpath, string $destinationXpath) $this->executeJsOnElement($source, $script); $this->getWebDriverSession()->buttondown(); - $this->getWebDriverSession()->moveto(array( - 'element' => $destination->getID() - )); + if ($destination->getID() !== $source->getID()) { + $this->getWebDriverSession()->moveto(array( + 'element' => $destination->getID() + )); + } $this->getWebDriverSession()->buttonup(); $script = <<