There are two ways of escaping the scope of within
. The first would be to use XPath and taking advantage of the Xpath-trap (https://github.com/teamcapybara/capybara#beware-the-xpath--trap) by intentionally breaking the scope
assert_xpath '//*', class: 'datepicker-dropdown', count: 1
The second (and probably clearer) method would be to use the page.document
method to escape the current scope
assert_selector page.document, '.datepicker-dropdown', count: 1
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…