Posts

Showing posts from May, 2014

Capybara: How to Control from Terminal

Image
When you write test scripts, you may want to get quick result if the entered command is working as what it is expected. The easiest way of controlling the command is to try it on simultaneously from your terminal. Using Capybara via terminal is very easy and fast. 
Just copy and paste what is written in your env.rb file and see the result. However basically you can type the following lines after typing irb for Ruby execution window. 
require 'capybara/dsl' include Capybara::DSL Capybara.default_driver = :selenium
And then you can type your commands like as below, actually you can do what you are doing in your Ruby file: 
irb(main):004:0> visit "http://www.amazon.com"
irb(main):005:0> fill_in "twotabsearchtextbox", :with => "nexus 5"
irb(main):006:0> find(:xpath, "//*[@class='nav-submit-input']").click()