Posts

Showing posts with the label capybara

Execute JavaScript + Capybara

There are certain cases where we need some custom JavaScript while writing some Integration test cases. For such cases you can use page.execute_script. For Example page.execute_script("$('#blog-hover-#{blog.id}').show();")

Browser Testing from Rails console using Capybara and selenium

To begin with you need to install the Capybara gem gem install capybara Once the gem is installed you can follow the below mentioned procedure. nishant@Nishant-Lap:~/Desktop/capybara$ rails c   Loading development environment (Rails 3.2.13) 1.9.3p392 :001 > require 'capybara/dsl' => true 1.9.3p392 :002 > include Capybara::DSL => Object 1.9.3p392 :003 > Capybara.default_driver = :selenium => :selenium 1.9.3p392 :004 > visit "http://google.com" => "" 1.9.3p392 :005 > page.fill_in('q', :with => 'nishant nigam')