测试 关于 Capybara 的 have_selector 方法

shangrenzhidao · May 23, 2014 · Last by shangrenzhidao replied at May 23, 2014 · 2061 hits

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') }

You need to Sign in before reply, if you don't have an account, please Sign up first.