When(/^I click the "(.*?)" link$/) do |subscribe|
click_on subscribe
end订阅链接转到外部网站:
https://www.somesite.com/path/to/something?this=that但是,当我运行该特性时,我会得到以下错误:
No route matches [GET] "/path/to/something" (ActionController::RoutingError)如何让水豚遵循这个外部链接而不忽略查询?
发布于 2015-01-29 05:12:11
不幸的是,黄瓜和凯巴拉不适用于外部链接。我建议您使用Capybara机械化:https://github.com/jeroenvandijk/capybara-mechanize
尝试此操作(尽管只适用于一个链接):
When(/^I click the "(.*?)" link$/) do
Capybara.current_driver = :mechanize
visit 'https://www.somesite.com/path/to/something?this=that'
end下面是一些使用它的示例:http://turriate.com/articles/2011/feb/testing-twitter-oauth-with-real-data/
https://stackoverflow.com/questions/26836739
复制相似问题