rautomation

RAutomation – Rubygem

RAutomation is a small and easy to use library for helping out to automate windows and their controls for automated testing. RAutomation provides: * Easy to use and user-friendly API (inspired by Watir http://www.watir.com) * Cross-platform compatibility * Easy extensibility – with small scripting effort it’s possible to add support for not yet supported platforms or technologies

Installation:

>gem install rautomation
>gem install ffi

Sample Code:

require “rautomation”
window = RAutomation::Window.new(:title => /part of the title/i)
window.exists? # => true
window.title # => “blah blah part Of the title blah”
window.text # => “Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ultricies…”
window.text_field(:class => “Edit”, :index => 0).set “hello, world!”
button = window.button(:text => “&Save”)
button.exists? # => true
button.click
all_windows = RAutomation::Window.windows
all_windows.each {|window| puts window.hwnd}
window = RAutomation::Window.new(:title => /part of the title/i)
windows = window.windows
puts windows.size # => 2
windows.map {|window| window.title } # => [“part of the title 1”, “part of the title 2”]
window.windows(:title => /part of other title/i) # => all windows with matching specified title
window.buttons.each {|button| puts button.value}
window.buttons(:value => /some value/i).each {|button| puts button.value}
window2 = RAutomation::Window.new(:title => “Other Title”, :adapter => :autoit) # use AutoIt adapter
# use adapter’s (in this case AutoIt’s) internal methods not part of the public API directly
window2.WinClose(“[TITLE:Other Title]”)

Advertisements

7 thoughts on “RAutomation – Rubygem

  1. Hi Ravi, Could you show me how to reference a ListBox and its items. For instance one of my site is SSL based and requires a certificate to get in. I have multiple certificates installed, so when I visit url I am shown a window saying “Choose a digital certificate” popup. How do I refer to this listbox and navigate and select one certificate from it?.

      1. Yes, it is a web application. Just now I tried the following, but got “UiaDLL” error.

        require ‘rautomation’
        require ‘watir-webdriver’

        b = Watir::Browser.new :ie
        b.goto(URL) ==> Requires Certificate. A popup is show “Choose a digital certificate”

        RAutomation::Window.new(:title=>/digital/i).exist? ==> returns true

        w = RAutomation::Window.new(:title=>/digital/i)

        w.list_box(:value=>/Certificate List/i).exist?

        This step produces UiaDLL error.

  2. Please tell me how to access contents in a list box eg in the “choose a digital certificate” window, i am able to get hold of the list box, but not the contents

    1. Hi Vidya

      1. You can access the list box then
      2. Press DOWN Arrow
      3. The first option will be the VALUE of LIST BOX.
      4. Collect and check whether its expected VALUE or not
      5. If not “PRESS again DOWN Key”
      6. repeat 4
      7. Once the value matched then proceed with the next field.

      Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s