Skip to content

Commit

Permalink
Merge pull request #359 from mvorisek/no_moveto_when_dragging_over_it…
Browse files Browse the repository at this point in the history
…self

Don't perform unneeded WebDriver\Session::moveto() call when dragging onto itself
  • Loading branch information
aik099 authored Nov 2, 2024
2 parents 28f43ec + 696ed94 commit db44be5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Selenium2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -978,12 +978,14 @@ 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(
'element' => $destination->getID()
));
if ($destination->getID() !== $source->getID()) {
$this->getWebDriverSession()->moveto(array(
'element' => $destination->getID()
));
}
$this->getWebDriverSession()->buttonup();

$script = <<<JS
Expand All @@ -996,7 +998,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)
Expand Down

0 comments on commit db44be5

Please sign in to comment.