SlideShare a Scribd company logo
Capybara
backend for
  Ruby DSL                              Cucumber
                  Capybara
                  driver agnostic

  RackTest -                        Selenium - default
default browser                      javascript driver
set it up !!

sudo gem install capybara

rails app : rails generate cucumber:install --
capybara

non rails app :

   require 'capybara/cucumber'

   Capybara.app = MyRackApp

https://github.com/jnicklas/capybara
all about drivers
Capybara.javascript_driver = :selenium

Capybara.default_driver = :selenium

register new driver

  Capybara.register_driver :celerity do |app|
  Capybara::Driver::Celerity.new(app,:browser
  => :chrome) end

Currently supported drivers

  RackTest

  Selenium 2.0 - Webdriver

  HtmlUnit - Akephalos, Celerity, Culerity

  Capybara-webkit
capybara dsl
navigation - visit

clicks - click_link

finders - find_field

matchers - page.has_xpath?

actions - fill_in

scope - within

scripting - page.execute_script()

http://rubydoc.info/github/jnicklas/capybara/master
google_steps.rb


When /^I search google for "([^"]*)"$/ do |search_string|
      visit("http://google.com")
      fill_in ('q', :with => search_string)
      click_button ('Search')
end


Then /google should .+ "([^"]*)"/ do |expected_substring|
      page.should have_content(expected_substring)
end
reduce build time


tagging

use headless webdriver
what else?
capybara-firebug

use capybara with rspec

run on remote server using

    Capybara.run_server = false

supports both xpath and css

http://google-opensource.blogspot.com/2009/05/introducing-
webdriver.html

More Related Content

PPTX
Capybara + RSpec - ruby dsl-based web ui qa automation
PDF
Capybara with Rspec
PDF
Put a Button on It: Removing Barriers to Going Fast
PDF
Ansible
PDF
Creating applications with Grails, Angular JS and Spring Security
PDF
Ansible 101 - Presentation at Ansible STL Meetup
PDF
Ansible - Hands on Training
PDF
Creating applications with Grails, Angular JS and Spring Security - GR8Conf E...
Capybara + RSpec - ruby dsl-based web ui qa automation
Capybara with Rspec
Put a Button on It: Removing Barriers to Going Fast
Ansible
Creating applications with Grails, Angular JS and Spring Security
Ansible 101 - Presentation at Ansible STL Meetup
Ansible - Hands on Training
Creating applications with Grails, Angular JS and Spring Security - GR8Conf E...

What's hot (20)

PDF
Introduction to ansible galaxy
PDF
Mastering Grails 3 Plugins - GR8Conf EU 2016
KEY
Impression of Rails 3
PDF
NodeWay in my project & sails.js
KEY
Rails with mongodb
PDF
FITC - Here Be Dragons: Advanced JavaScript Debugging
PPTX
Azkaban and Pig at LinkedIn
PPTX
SQL Start! 2019 - Ancona - Distribuisci ed amministra le tue istanze SQL Serv...
PDF
Rails course day 8
PDF
TDC2016SP - Esqueça Grunt ou Gulp. Webpack and NPM rule them all!
PDF
Introduction to ansible
PDF
High Performance Drupal
PPTX
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
PPTX
Azure cli2.0
PPTX
Putting the 'ctions' in Azure Fun-ctions
PDF
Rest with grails 3
PDF
Webpack & React Performance in 16+ Steps
PPTX
Packing for the Web with Webpack
PPT
Big Data DC - BenchPress
PDF
Rails after 5 years
Introduction to ansible galaxy
Mastering Grails 3 Plugins - GR8Conf EU 2016
Impression of Rails 3
NodeWay in my project & sails.js
Rails with mongodb
FITC - Here Be Dragons: Advanced JavaScript Debugging
Azkaban and Pig at LinkedIn
SQL Start! 2019 - Ancona - Distribuisci ed amministra le tue istanze SQL Serv...
Rails course day 8
TDC2016SP - Esqueça Grunt ou Gulp. Webpack and NPM rule them all!
Introduction to ansible
High Performance Drupal
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Azure cli2.0
Putting the 'ctions' in Azure Fun-ctions
Rest with grails 3
Webpack & React Performance in 16+ Steps
Packing for the Web with Webpack
Big Data DC - BenchPress
Rails after 5 years
Ad

Viewers also liked (10)

PDF
Jenkins CI
PDF
Introduction To Django (Strange Loop 2011)
KEY
Make It Cooler: Using Decentralized Version Control
PDF
A quick python_tour
PDF
Outside-In Development With Cucumber
PPTX
Prepare for JDK 9
PPT
Introduction to Git for developers
PDF
Two scoops of Django - Security Best Practices
PDF
The WHY behind TDD/BDD and the HOW with RSpec
PDF
Git Branching Model
Jenkins CI
Introduction To Django (Strange Loop 2011)
Make It Cooler: Using Decentralized Version Control
A quick python_tour
Outside-In Development With Cucumber
Prepare for JDK 9
Introduction to Git for developers
Two scoops of Django - Security Best Practices
The WHY behind TDD/BDD and the HOW with RSpec
Git Branching Model
Ad

Similar to Capybara (20)

PPTX
Capybara and cucumber with DSL using ruby
PPTX
Cucumber
PDF
Cross-browser testing in the real world
PPTX
Autotesting rails app
PDF
Fisl - Deployment
PDF
Deployment de Rails
PDF
Padrino - the Godfather of Sinatra
PDF
AngularJS meets Rails
PDF
Dynamic Languages & Web Frameworks in GlassFish
KEY
Leave end-to-end testing to Capybara
PDF
Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]
ODP
Jenkins and rails app - Le Dinh Vu
PPT
1st Chinaonrails Open Course 高级战略
PDF
5 Takeaways from Migrating a Library to Scala 3 - Scala Love
PDF
Asset Pipeline in Ruby on Rails
PDF
JRuby on Rails Deployment: What They Didn't Tell You
PDF
Intro to sbt-web
PDF
Instrumentación de entrega continua con Gitlab
PDF
infra-as-code
PPTX
ScyllaDB Kubernetes Operator Goes Global
Capybara and cucumber with DSL using ruby
Cucumber
Cross-browser testing in the real world
Autotesting rails app
Fisl - Deployment
Deployment de Rails
Padrino - the Godfather of Sinatra
AngularJS meets Rails
Dynamic Languages & Web Frameworks in GlassFish
Leave end-to-end testing to Capybara
Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]
Jenkins and rails app - Le Dinh Vu
1st Chinaonrails Open Course 高级战略
5 Takeaways from Migrating a Library to Scala 3 - Scala Love
Asset Pipeline in Ruby on Rails
JRuby on Rails Deployment: What They Didn't Tell You
Intro to sbt-web
Instrumentación de entrega continua con Gitlab
infra-as-code
ScyllaDB Kubernetes Operator Goes Global

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Big Data Technologies - Introduction.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPT
Teaching material agriculture food technology
PDF
Electronic commerce courselecture one. Pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Approach and Philosophy of On baking technology
PDF
cuic standard and advanced reporting.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Encapsulation theory and applications.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
sap open course for s4hana steps from ECC to s4
Big Data Technologies - Introduction.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Review of recent advances in non-invasive hemoglobin estimation
Teaching material agriculture food technology
Electronic commerce courselecture one. Pdf
MYSQL Presentation for SQL database connectivity
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Spectroscopy.pptx food analysis technology
Understanding_Digital_Forensics_Presentation.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Approach and Philosophy of On baking technology
cuic standard and advanced reporting.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...

Capybara

  • 2. backend for Ruby DSL Cucumber Capybara driver agnostic RackTest - Selenium - default default browser javascript driver
  • 3. set it up !! sudo gem install capybara rails app : rails generate cucumber:install -- capybara non rails app : require 'capybara/cucumber' Capybara.app = MyRackApp https://github.com/jnicklas/capybara
  • 4. all about drivers Capybara.javascript_driver = :selenium Capybara.default_driver = :selenium register new driver Capybara.register_driver :celerity do |app| Capybara::Driver::Celerity.new(app,:browser => :chrome) end Currently supported drivers RackTest Selenium 2.0 - Webdriver HtmlUnit - Akephalos, Celerity, Culerity Capybara-webkit
  • 5. capybara dsl navigation - visit clicks - click_link finders - find_field matchers - page.has_xpath? actions - fill_in scope - within scripting - page.execute_script() http://rubydoc.info/github/jnicklas/capybara/master
  • 6. google_steps.rb When /^I search google for "([^"]*)"$/ do |search_string| visit("http://google.com") fill_in ('q', :with => search_string) click_button ('Search') end Then /google should .+ "([^"]*)"/ do |expected_substring| page.should have_content(expected_substring) end
  • 7. reduce build time tagging use headless webdriver
  • 8. what else? capybara-firebug use capybara with rspec run on remote server using Capybara.run_server = false supports both xpath and css http://google-opensource.blogspot.com/2009/05/introducing- webdriver.html

Editor's Notes