ruby Capybara + Poltergeistの雏形

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby Capybara + Poltergeistの雏形相关的知识,希望对你有一定的参考价值。

source "https://rubygems.org"

 gem 'capybara'
 gem 'nokogiri'
 gem 'poltergeist'
require 'bundler/setup'
require 'capybara/poltergeist'
require 'capybara/dsl'
Bundler.require

class Test
  include Capybara::DSL

  def initialize()
    Capybara.register_driver :poltergeist_debug do |app|
      Capybara::Poltergeist::Driver.new(app, :inspector => true, :js_errors => false)
    end

    Capybara.run_server = false
    Capybara.default_driver = :poltergeist
    Capybara.javascript_driver = :poltergeist
    Capybara.default_selector = :xpath    
  end
end

以上是关于ruby Capybara + Poltergeistの雏形的主要内容,如果未能解决你的问题,请参考以下文章

ruby capybara_screenshots.rb

ruby capybara.rb

ruby Capybara自动保存测试失败的屏幕截图

ruby capybara_wait_until.rb

ruby capybara_wait_until.rb

使用 selenium ruby​​ capybara 拖放