我正在使用Cucumber + Webrat +机械化适配器,并希望测试页的内容,这些页面是通过iframed或框框到所选页面中的。
换言之:
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]"这给我留下了两个问题:
发布于 2010-01-04 21:52:32
这将回答问题的第一部分。
Then /^I should see login details in frame header$/ do
within 'frame[name=header]' do |frame|
frame_src = frame.dom.attributes["src"].value
visit frame_src
response_body.should contain "Log in with digital certificate"
response_body.should_not contain "Log out"
end
end发布于 2010-01-20 18:44:57
你没必要那样做。因为您的浏览器已经在自动加载框架,所以只需告诉selenium(因此是webrat)要查看哪个框架。
When /^I select the "(.*)" frame$/ do |name|
selenium.select_frame("name=#{name}")
end发布于 2010-08-12 15:47:32
在步骤定义中尝试这样做:
within_frame("headerid") do
assert page.has_content? "login details"
endhttps://stackoverflow.com/questions/2002116
复制相似问题