Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve compatibility with GeckoDriver when using Selenium 3 #255

Merged
merged 1 commit into from
Feb 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Selenium2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Behat\Mink\Selector\Xpath\Escaper;
use WebDriver\Element;
use WebDriver\Exception\NoSuchElement;
use WebDriver\Exception\UnknownCommand;
use WebDriver\Exception\UnknownError;
use WebDriver\Exception;
use WebDriver\Key;
Expand Down Expand Up @@ -764,7 +765,13 @@ public function click($xpath)

private function clickOnElement(Element $element)
{
$this->wdSession->moveto(array('element' => $element->getID()));
try {
// Move the mouse to the element as Selenium does not allow clicking on an element which is outside the viewport
$this->wdSession->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
}

$element->click();
}

Expand Down