测试 关于 Capybara 的 have_selector 方法

shangrenzhidao · 2014年05月23日 · 最后由 shangrenzhidao 回复于 2014年05月23日 · 2061 次阅读

capybara 2.1.0 it { should have_selector('div.alert.alert-error', text: 'Invalid') }

这是页面对应的源码:

Invalid email/password combination

it { should have_selector('div.alert.alert-error', content: 'Invalid') } 可以通过。 各位友人,可否给个建议。

原因是我没有认真看文档。应该是 it { should have_text('Invalid') }

需要 登录 后方可回复, 如果你还没有账号请 注册新账号