如何将鼠标悬停在具有Codeception的元素上


How do I hover mouse over an element with Codeception?

希望有人可以帮助/指出我的答案....

我正在使用Codeception来测试我们的网站。 一切都很好,除了我找不到将鼠标悬停在菜单元素上以显示菜单其余部分的方法。

使用

watir和webdriver,我能够使用

browser.div(:class->"menu-item-1").hover

我确实找到了moveMouseOver,但它似乎不起作用。我试过了

moveMouseOver('//div/div/div/div/ul/li[2]/a')

移动鼠标悬停('.menu-item-1')

这适用于 Codeception 版本 2.0.9(用于测试在 WordPress 博客文章上的图像悬停时 Pin It 按钮的外观):

$I->amOnPage( '/blog/post-1/' );
$I->moveMouseOver( '.entry-content img' );
$I->seeElement( 'a[title="Pin it!"]' );