Monday, October 14, 2013

Appium on windows - Android automation using ruby

Prerequisite -

  1. Android SDK with API level 17 and above is available.
  2. Ruby 1.9 and selenium - webdriver gem is installed.
  3. OS variable ANDROID_HOME is pointing to SDK folder

Here are Quick Steps to Setup and Run Sample App using ruby selenium webdriver.

  1. Download latest Appium for Windows from , unzip it.
  2. Start Emulator or Connect your Device using USB.
  3. Download ContactManager.apk from
  4. adb install ContactManager.apk.
  5. Click on Appium.exe from unzipped folder and Start Appium Server by clicking on Launch Button with Default parameters.
  6. Run below ruby code from cmd / irb 


require 'selenium-webdriver'

capabilities = {
'device' => 'Android',
  'browserName' => '',
  'platform' => 'WINDOWS',
  'version' => '4.2.2',
  #'app' => 'http://localhost/ContactManager.apk',
'app-package' => '',
'app-activity' => 'ContactManager'

server_url = ""

@driver = Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => server_url)

btadd = @driver.find_element(:name, "Add Contact")

textfields = @driver.find_elements(:tag_name,"textfield")
@driver.find_element(:name, "Save").click()




  1. Hello,
    I'm trying to do your thing but I've got this error : C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill': Timeout::Error (Timeout::Error).
    It's the first time I'm doing automation on Android device. Genymotion is runing, I can see the device with the command "adb devices"
    "List of devices attached device"
    Appium.exe is running Node server.
    I'm in Rubymine. I've installed a good COntactmanager on the fake device, app is ok manually.
    I'm runing your script with this parameters :
    capabilities = {
    'deviceName' => 'Android',
    'browserName' => '',
    'platformName' => 'Android',
    'version' => '4.4.2',
    'app' => 'http://localhost/ContactManager.apk',
    'app-package' => '',
    'app-activity' => 'ContactManager'

    And TimeOut...
    I don't even know if I can reach my emulator.
    Can you help me on this ? It's been 10 days I'm trying, I'm completly lost !
    thanks a lot

  2. can anyone explain it detail about installation