Created
November 6, 2009 13:50
-
-
Save rainchen/227990 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cucumber helper for multiple forms in one page by RainChen @ 2009-11-06 | |
# more detail: http://hi.baidu.com/rainchen/blog/item/dfad7931f77e2413ebc4afc1.html | |
# select a form as current scope | |
When /^I focus on the form which "([^\"]*)" is "([^\"]*)"$/ do |attr, value| | |
selector = "form[@#{attr}='#{value}']" | |
# within using: Webrat::XML.css_at(@scope.dom, @selector) | |
# p webrat_session.within("form[@action='/pages/search']") {|scope| scope.dom } | |
# xpath_search requried ".//" , for example: | |
# Webrat::XML.xpath_search(webrat_session.current_scope.dom, ".//form[@action='/pages/search']") | |
# when found, webrat_session.current_scope.dom.object_id should be changed | |
webrat_session.scopes.push(Webrat::Scope.from_scope(webrat_session, webrat_session.current_scope, selector)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment