我在线阅读了很多文章,但尚未找到解决问题的方法。我正在使用Selenium webdriver:
Capybara.default_driver = :selenium
Capybara.javascript_driver = :selenium
class FirefoxBrowser
Capybara.register_driver :firefox do |app|
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 280
Capybara::Selenium::Driver.new(app, :browser => :firefox, :http_client => client)
end
end
这是gemfile:
gem "rspec"
gem "ZenTest"
gem "cucumber"
gem "selenium-webdriver"
gem "capybara", "~> 2.1.0"
gem "capybara-webkit", "~> 1.0.0"
gem "simplecov", :require =>false, :group => :test
gem "capybara-screenshot"
gem "autotest", "~> 4.4.6"
gem 'json', '~> 1.7.7'
gem "rack-test", require: "rack/test"
gem "poltergeist"
我使用类似以下内容的capybara运行一些ruby代码:
访问“https://username:password@website.com/other_params”
此调用将返回一个XML,其中包含有关我所做的任何调用的信息。 从那里,我检查页面是否有我想要的东西:
page.should have_content(“content”)
无法找到xpath“/ html”(Capybara :: ElementNotFound)
在我们升级到capybara 2.1.0
之前,这是有效的既然我们已经升级了,我似乎无法解决这个问题。有什么建议吗?
答案 0 :(得分:1)
尝试更新你的selenium-driver(它适用于我):
gem 'selenium-webdriver', "~> 2.34.0"