Sahi is an alternative to Selenium(http://seleniumhq.org/) for web automation. But none of them support real mouse hover (a.k.a CSS hover), but thanks to the powerful XTEST library and xdotool, a command line tool that emulates fake keyboard and mouse, the missing feature can be implemented.

Following an example:

class ClientContext extends BehatContext implements MinkAwareInterface
{

   ...

    /**
     * @Then /^I should see a color change for menu "([^"]*)"$/
     */
    public function iShouldSeeAColorChangeForMenu($menuName)
    {
        /** @var $session \Behat\Mink\Session */
        $session = $this->mink->getSession();

        /** @var $page \Behat\Mink\Element\DocumentElement() */
        $page = $session->getPage();
        $links = $page->findAll('css', 'ul.nice-menu li a');

        /** @var $link \Behat\Mink\Element\NodeElement */
        foreach ($links as $link) {
            if ($link->getText() == $menuName) {
                $jquery = <<< EOF
(jQuery("ul.nice-menu li a:first").offset().top)
EOF;
                $top = $session->evaluateScript($jquery) + 130;
                $jquery = <<< EOF
(jQuery("ul.nice-menu li a:first").offset().left)
EOF;
                $left = $session->evaluateScript($jquery) + 100;
                system('xdotool mousemove ' . $left . ' ' . $top);
                $session->wait(1000);
                $jquery = <<< EOF
(-1 !== jQuery("ul.nice-menu li a:first").css('color').search('255'))
EOF;
                assertSame($session->evaluateScript($jquery), 'true');
            }
        }
    }
}

Notice that this test is platform specific, will only run on Linux. Also, it has the browser position hardcoded, still needs some work to work properly (use xdotool to find the sahi browser window and grab its coords).

I’m pretty newbie to Sahi, but you can help this code work like a pro.

Blessings!