Skip to main content

Posts

Showing posts with the label terminal

How to Run Capybara with Poltergeist Mode by Terminal

In Poltergeist mode or headless mode, it is different from Selenium since there is no browsers which you can track failure visually. The advantages of Poltergeist are: it is faster, it demands less source when we compare to Selenium, and eventually it is more suitable for Continues Integration (CI). Installation and further information about Poltergeist you can visit git page . Running Capybara with terminal may help you to get quick result. By this way you can check if button, field, or any object can be reachable easily and this method may help you to reduce failure issue on your CI and get you more realistic results. You can just paste the following commands into your terminal, it will go to home page of Amazon.

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