Reputation: 622
I need to double click an dom element using Selenium Webdriver - Facebook PHP library.
There's no direct way to perform a double click on the element, but there's a way over WebDriverMouse
this is how far I've got.
$myElement = $myWebDriver->findElement(WebDriverBy::id('myElement'));
$myWebDriver->getMouse()->doubleClick($myElement->getLocation());
Unfortunately this isn't working since ->getLocation
returns an instance of WebDriverPoint
but the method ->doubleClick()
needs an instance of WebDriverCoordinates
.
Is there an easier way to perform the double click or is there a way do create a WebDriverCoordinates
instance out of a WebDriverPoint
object?
Thank you very much for you help.
Upvotes: 1
Views: 4743
Reputation: 789
Here is an alternative using the action builder.
$myElement = $myWebDriver->findElement(WebDriverBy::id('myElement'));
$driver->actions()->doubleClick()->perform();
Also, $driver->actions()
allows action chain / composite actions.
Drag and Drop example:
$driver->actions()->mouseDown($source)
->mouseMove($target)
->mouseUp($target);
->perform();
But actually, you can do drag and drop by just one method.
$driver->actions()->dragAndDrop($source, $target)->perform();
Upvotes: 1
Reputation: 622
Sorry, was to fast with the question. Just figured it out:
$myElement = $myWebDriver->findElement(WebDriverBy::id('myElement'));
$myWebDriver->getMouse()->doubleClick($myElement->getCoordinates());
Upvotes: 4