From 6c4b35ceea505b0317cec148458b4af9f764c51a Mon Sep 17 00:00:00 2001 From: Sally Young Date: Wed, 13 Dec 2023 17:56:03 +0000 Subject: [PATCH] fix moveto --- src/Selenium2Driver.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php index 15828062..888df516 100755 --- a/src/Selenium2Driver.php +++ b/src/Selenium2Driver.php @@ -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)