开发者

Capybara/Selenium test for jquery autocomplete not working if Firefox is not made active

I'm running into an issue with the following code in a capybara test (covering a jquery autocomplete select)

page.eva开发者_开发百科luate_script %Q{ $('.ui-menu-item a:contains("#{target}")').trigger("mouseenter").click(); }

When Firefox is made active while the test is running, the test passes. When it remains inactive the test fails. This appears to be documented in this issue but I am wondering if anyone has found a work around.

I'm on OS X 10.6.7 and have tried FF 4 and 3.6.10

Thanks in advance!


As an alternative way I'm using the capybara-webkit gem instead of selenium together with the headless gem and that works great for me.


Since you're on a mac, you can work around this by using applescript to force firefox to the front. Add the following line to your ruby code wherever you need firefox to be on top:

`osascript -e \"tell application \\\"Firefox\\\" to activate\"`

Taken from here: https://gist.github.com/2427601

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜