Capybara: How to Control from Terminal

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()





Comments

Popular posts from this blog

Selenium Error "Element is not currently interactable and may not be manipulated"

Change Default Timeout and Wait Time of Capybara

Performance Testing on CI: Locust is running on Jenkins

Selenium Chromedriver Error Message: u'unknown error: unable to discover open pages

Getting the text of elements in Espresso