File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414use Behat \Mink \Selector \Xpath \Escaper ;
1515use WebDriver \Element ;
1616use WebDriver \Exception \NoSuchElement ;
17+ use WebDriver \Exception \UnknownCommand ;
1718use WebDriver \Exception \UnknownError ;
1819use WebDriver \Exception ;
1920use WebDriver \Key ;
@@ -764,7 +765,13 @@ public function click($xpath)
764765
765766 private function clickOnElement (Element $ element )
766767 {
767- $ this ->wdSession ->moveto (array ('element ' => $ element ->getID ()));
768+ try {
769+ // Move the mouse to the element as Selenium does not allow clicking on an element which is outside the viewport
770+ $ this ->wdSession ->moveto (array ('element ' => $ element ->getID ()));
771+ } catch (UnknownCommand $ e ) {
772+ // If the Webdriver implementation does not support moveto (which is not part of the W3C WebDriver spec), proceed to the click
773+ }
774+
768775 $ element ->click ();
769776 }
770777
You can’t perform that action at this time.
0 commit comments