Webrat 验证 iframe 或框架集中的内容
我正在使用 Cucumber + Webrat + Mechanize 适配器,并且想要测试 iframe 或框架到所选页面中的页面内容。
换句话说:
Scenario: View header on webpage
Given I visit a page containing a frameset
When there is a header frame
Then I should see login details in frame header
问题当然是最后一步:我需要导航到框架标题并调查其内容。我可以验证框架标签是否在这里
response_body.should have_selector "frame[src][name=header]"
这给我留下了两个问题:
- 如何读取 src 属性并导航到该页面
- 如何导航回原始页面
I am using Cucumber + Webrat + Mechanize adapter and want to test contents of pages that are iframed or framed into the selected page.
In other words:
Scenario: View header on webpage
Given I visit a page containing a frameset
When there is a header frame
Then I should see login details in frame header
The problem is of course the last step: I need to navigate to the frame header and investigate it's contents. I can verify the frame tag is here
response_body.should have_selector "frame[src][name=header]"
This leaves me with two questions:
- How to read the src attribute and navigate to that page
- How to navigate back to the original page
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这将回答问题的第一部分
This would answer the first part of the question
你实际上不必这样做。因为您的浏览器已经自动加载帧,所以您只需告诉 selenium(以及 webrat)您想要查看哪个帧。
you don't actually have to do it that way. Because your browser is already loading the frames automatically, you simply need to tell selenium(and thus webrat) which frame you want to look at.
在步骤定义中尝试这个:
try this in the step definition: