Google+ Followers

Friday, 23 January 2015

Useful calabash queries : methods to count elements / read elements and find text present

These are queries used with UI picker view -

Scrolling to particular row: 

Read elements from picker view
query("pickerView",:delegate, [{pickerView:nil},{titleForRow:3},{forComponent:0}])
Count Number of items in picker view


Wednesday, 19 November 2014

Android Phone : how to proxy network requests using charles (explained with screenshots)

Have a wifi network on which PC( MAC) and Mobile phone are connected
record IP address of PC and Mobile
Mobile: 192.168.1.XX


Performed on Mobile:

  1. Open Settings
  2. Selected the network connected
  3. Press long tap and choose modify network
  4. Select show advanced options 
  5. Select Manual
  6. Enter the IP address of the machine running and port as 8888 
  7. Press SAVE 
  8. go to browser (chrome) and open a website ""


  1. Download charles from here and launch it,
  2.  (now perform step 11 in mobile) Charles shows a dialog requesting to allow incoming connections
  3. Once the connections are allowed, any request made to internet from mobile will appear in charles, use the filter to refine the request (as shown in image below

Tuesday, 28 October 2014

command line command to list all IOS simulators installed on my mac

Open Terminal and run the below command
xcrun instruments -s devices

expected output:
Known Devices:
LON02759 (
iPhone - Simulator - iOS 7.1
iPhone Retina (3.5-inch) - Simulator - iOS 7.1
iPhone Retina (4-inch) - Simulator - iOS 7.1
iPhone Retina (4-inch 64-bit) - Simulator - iOS 7.1
iPad - Simulator - iOS 7.1
iPad Retina - Simulator - iOS 7.1
iPad Retina (64-bit) - Simulator - iOS 7.1

Wednesday, 30 April 2014

Calabash IOS / Android most used commands

Commands to check id's of all elements present in view
query("view,:id") for IOS 
query("*,:id") for android

Commands to list description of all elements 
query("view,:description") for IOS 
query("*,:description") for android

Sunday, 27 April 2014

Ruby subtract unix times and convert it into days and format DateTime

require 'date'
DateTime.strptime(,'%s').strftime("%d %m %y")
#find difference between 2 date times

calabash ruby: Installing ruby rvm on mac OSX why and how

Why Ruby or RVM ?
Calabash commands needs ruby to be installed for interpreting commands to actions.

Which version of ruby to install ? - 
Check here pre requisites section in this link
Currently its 2.0+

Why Rvm ?  -  RVM is used to manage to rubies on mac 

Alternative to RVM ?  -  use rbenv 

How to install rvm ?
run these command from terminal on mac

$ \curl -sSL | bash -s stable --ruby
(there is a backslash before curl. This prevents misbehaving if you have aliased it with configuration in your ~/.curlrc file)
Then install required version of ruby ..
$ rvm install 2.0.0
$ rvm use 2.0.0
You can set a version of Ruby to use as the default for new shells. Note that this overrides the ‘system’ ruby
$ rvm use 2.1.0 --default

Check here for more documentation -
      • When to clean and install - Check errors section below
      • How to verify RVM installation is successful

      Close existing terminal and reopen new terminal window
      a) type this command in terminal 'open ~/.bash_profile' check if you see code the this 


      [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.

      b) type this command 'rvm list'
      check ouput it must be like below

      ~ $: rvm list

      rvm rubies
         ruby-2.0.0-p353 [ x86_64 ]
      =* ruby-2.0.0-p451 [ x86_64 ]

      # => - current

      # =* - current && default
      #  * - default

      c) Ruby version currently used 

      ~ $: ruby -v

      ruby 2.0.0p451 

      Common Issues: While installing calabash gems 
        1) Error during RVM installation
        About to install Homebrew, press `Enter` for default installation in `/usr/local`,
        type new path if you wish custom Homebrew installation (the path needs to be writable for user)
        : Requirements installation failed with status: 1.

        2) ERROR:  While executing gem ... (Gem::FilePermissionError)
            You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
        lon04-04266:~ dakojuu$ sudo gem install calabash-cucumber
        Building native extensions.  This could take a while...
        ERROR:  Error installing calabash-cucumber:
        ERROR: Failed to build gem native extension.

            /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
        checking for main() in -lc... yes
        creating Makefile
          Solution resintall RVM

          Thursday, 17 April 2014

          Android -adb fast and easy way to get screenshots

          • Connect android device to PC / Mac ( make sure android sdk path is set)
          • run below commands, screen shot of current screen is taken and save on to current folder from where this command is run
          adb shell screencap -p /sdcard/screen.png
          sleep 0.1
          adb pull /sdcard/screen.png