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);