If you are working on shell most of the time Aliases are very helpfull and time saving. For testing purposes you can use Alias for getting ready your test suites. In this post, I want to explain both running Selenium and Capybara on console and creating aliases for each. This post is for Windows machines, if you are using Unix-like see this post.
Creating Scripts for Selenium and Capybara
First of all, it is assumed that you have installed Selenium and Capybara correctly and they work on your machines. If you haven't installed, you can see my previous posts. I am using the Selenium with Python and the Capybara with Ruby. You can use several different language for Selenium but Capybara works only with Ruby. Create scripts in a directory called scripts (in your home folder, like as ~/scripts) for your automation tool as following, save them as capybara.rb, sel.py:
Depends on your favourite shell, you need to add the alias to .bashrc bash shell, config_fish for fish shell and etc. You can see the example for fish and bash shell as following:
For fish: edit ~/.config/fish/config.fish
alias capybara "irb ~/scripts/capybara.rb" alias sel "python -i ~/scripts/sel.py"
For Bash: edit ~/.bashrc
alias capybara="irb ~/scripts/capybara.rb" alias sel="python -i ~/scripts/sel.py"
To run it
Open your shell and type sel chrome for Selenium with Chrome and capybara poltergeist is for Capybara with Poltergeist browser. Keep in mind that the scripts are include minimum required library so if you want additional functionalities you can import/require them.
~ sel chrome ~ sel firefox ~ capybara selenium ~ capybara chrome ~ capybara poltergeist