Rails 3、Cucumber、Capybara 无法选择元素/渲染完整的 html
黄瓜功能不断失败,因为水豚没有按照预期渲染整个 html,
这里是功能
When I select my "Test Cluster" from "Cluster Selection"
和步骤定义
When /^I select my "(.*)" from "(.*)"$/ do |field, value|
fill_in(field, :with => value)
end
它应该通过,但黄瓜/水豚一直抱怨它找不到带有标签“集群选择”的下拉菜单
所以我进入调试器模式并运行 cucumber
When /^I select my "(.*)" from "(.*)"$/ do |field, value|
debugger
fill_in(field, :with => value)
end
我发现,当我输入
pp page.body
所有内容时,它返回的是 HTML 文档声明。它缺少 和
,所以难怪它找不到下拉菜单。
有人有什么建议吗?
A cucumber feature keeps failing because capybara does not render the whole html as intended
here is the feature
When I select my "Test Cluster" from "Cluster Selection"
and the step definition
When /^I select my "(.*)" from "(.*)"$/ do |field, value|
fill_in(field, :with => value)
end
It should pass, but cucumber/capybara keeps complaining that it cannot find the dropdown with the label "Cluster Selection"
So I went into debugger mode and ran cucumber
When /^I select my "(.*)" from "(.*)"$/ do |field, value|
debugger
fill_in(field, :with => value)
end
What I found was that when I type
pp page.body
all it returns is the HTML doc declaration. It's missing the <head>
and <body>
, so no wonder it cant find the dropdown.
Anyone got any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论