开发者

capybara with selenium wait for onchange event

I have a form field with an onchange event which inserts some text into the page.

fill_in "password", :with => 'test' # should trigger onchange which inserts the text below into the page
page.should have_content('very insecure')

Now when I test this with cucumber/ capybara/ selenium with firefox it works without any 开发者_JS百科problems. Using selenium with chrome, capybara complains the text is not found in the document.

Now I wonder how to fix this. Do I need to manually invoke the event (which would be real hacky imo)? Or do I simply have to wait for all events being processed (how?) between my fill_in and should have_content methods?


If you feel that it is an issue that you need to wait longer, I would throw in a "sleep 3" before the page.should. There are also raw Selenium commands for this but it is best to avoid them.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜