Symfony + Panther: mouse over element

272 Views Asked by At

is there a way to simulate in panther testing, mouse over an element? To be more specific I want to check what css is attached to element:hover.

2

There are 2 best solutions below

0
Paul ALBERT On

This approach seems to work for me, since it moves the cursor over the item :

$this->client->getMouse()->mouseMove($crawler->filter('some item selector')->getElement(0)->getCoordinates());
0
J.Z. On

Per https://github.com/symfony/panther/blob/main/tests/WebDriver/WebDriverMouseTest.php, this works:

$this->client->getMouse()->mouseMoveTo("#some_id");
$this->client->getMouse()->mouseDownTo("#mouse_down_on_this");
$this->client->getMouse()->mouseUpTo("#mouse_up_on_this");

Cheers!