Skip to content

Commit

Permalink
fix moveto
Browse files Browse the repository at this point in the history
  • Loading branch information
justafish committed Dec 13, 2023
1 parent c8a1f2a commit 6c4b35c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/Selenium2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -846,16 +846,14 @@ public function click(string $xpath)

private function clickOnElement(Element $element): void
{
try {
if ($this->isW3C()) {
$element->click();
}
else {
// Move the mouse to the element as Selenium does not allow clicking on an element which is outside the viewport
$this->getWebDriverSession()->moveto(array('element' => $element->getID()));
} catch (UnknownCommand $e) {
// If the Webdriver implementation does not support moveto (which is not part of the W3C WebDriver spec), proceed to the click
} catch (UnknownError $e) {
// Chromium driver sends back UnknownError (WebDriver\Exception with code 13)
$element->click();
}

$element->click();
}

public function doubleClick(string $xpath)
Expand Down

0 comments on commit 6c4b35c

Please sign in to comment.