如何找到与Capybara第一次分页上看不到的记录
朋友,我有一个大问题。如果我注册记录,并且金额大于列表中显示的记录,则将其保存在另一个分页中。 Capybara仅在可见记录和第一个分页上发现。如果有多次打印,我该如何搜索此记录?
**I'm using this:**
def cad_diametro_material_active
input_cod.send_keys('aut_Server_AL')
input_order.send_keys('1')
@ger_material_active = 'automation_Server_ALUMINIO_ACTIVE'+ rand(1..99).to_s
input_description.send_keys(@ger_material_active)
btn_insert.click
find("td", text: @ger_material_active).click
**#The query was finding the record, but as the record moved to the other pagination it can't find it anymore. It seems that capybara only finds it when it is visible on the screen**
Friends, I have a big problem. If I register a record and the amount is greater than the one shown in the list, it is saved in another pagination. Capybara is only finding if the record is visible and on the first pagination. How do I search for this record if there are multiple paginations?
**I'm using this:**
def cad_diametro_material_active
input_cod.send_keys('aut_Server_AL')
input_order.send_keys('1')
@ger_material_active = 'automation_Server_ALUMINIO_ACTIVE'+ rand(1..99).to_s
input_description.send_keys(@ger_material_active)
btn_insert.click
find("td", text: @ger_material_active).click
**#The query was finding the record, but as the record moved to the other pagination it can't find it anymore. It seems that capybara only finds it when it is visible on the screen**
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Capybara测试用户将看到的内容 - 如果在屏幕上看到该项目,那么Capybara将不会“看到”它,因为用户不会。因此,您需要做用户将要做的事情,请单击屏幕上的任何内容将它们移至记录的下一页。作为测试仪,您应该控制测试数据,并知道记录将显示在显示结果的第一或第二页(或第三页)上,并相应地编写测试。您不会显示页面的HTML,因此无法确切地告诉您应该点击什么。
另外,请停止使用
send_keys
对所有事物 - 当您具有正常HTML输入类型元素时,请使用fill_in
或 set> set 在选择send_keys < /代码>
Capybara tests what the user would see - if the item isn't visible on the screen then Capybara won't "see" it because a user wouldn't. Therefore you need to do what a user would do, click whatever on the screen moves them to the next page of records. As a tester you should control the test data and know that the record will be showing on the first or second (or third) page of results being shown, and write your test accordingly. You don't show the HTML of your page so it's not possible to tell you exactly what you should be clicking on.
Also, stop using
send_keys
for everything -- when you have normal HTML input type elements usefill_in
orset
before opting forsend_keys