• Stars
    star
    100
  • Rank 330,137 (Top 7 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 13 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

RAutomation

RAutomation

Gem Version

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)
  • Cross-platform compatibility
  • Easy extensibility - with small scripting effort it's possible to add support for not yet supported platforms or technologies

USAGE

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(:value => "&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 &: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]")

Check out the documentation for other possible usages!

INSTALL

Windows

gem install rautomation

Available adapters:

  • :win_32 - uses Windows API directly with FFI (default)
  • :ms_uia - an experimental adapter
  • :autoit - uses AutoIt for automation (DEPRECATED)

When using AutoIt adapter: You might need administrative privileges if running for the first time and you haven't installed AutoIt before!

Linux

Feel yourself at home on Linux and know how to automate windows and their controls? I would be happy if you'd contact me about that matter - or even better, follow the instructions at "How to create a new adapter?"

OS X

Feel yourself at home on OS X and know how to automate windows and their controls? I would be happy if you'd contact me about that matter - or even better, follow the instructions at "How to create a new adapter?"

Others

Feel yourself at home on some operating system not listed in here and know how to automate windows and their controls? Does Ruby also work on that operating system? I would be happy if you'd contact me about that matter - or even better, follow the instructions at "How to create a new adapter?"

Supported Ruby Platforms

64bit Ruby platform is only supported for Win32 adapter. Other adapters can be used only on a 32bit Ruby!

How to create a new adapter?

  1. Fork the project.
  2. Create entry point file to lib/rautomation/adapter which should load all adapter specific files.
  3. Add autoload statement into lib/rautomation/adapter/helper.rb for that file.
  4. Create a directory for your adapter's specific code into lib/rautomation/adapter
  5. Copy button.rb, text_field.rb and window.rb from some of the existing adapter's directory.
  6. Add spec data for your adapter into spec/spec_helper DATA constant.
  7. Use environment variable RAUTOMATION_ADAPTER to point to that adapter.
  8. Start coding and spec-ing until as much of possible of the public API is satisfied.
  9. Make me a pull request.

Don't forget to fix the documentation for that adapter also!

In case of any problems, feel free to contact me.

Contributors

Libraries Using RAutomation

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history.

    (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright (c) Jarmo Pertman. See LICENSE for details.

More Repositories

1

require_all

A wonderfully simple way to load Ruby code
Ruby
413
star
2

test-page

Test::Page helps you to write easily maintainable integration tests using Watir, Selenium or any other testing library by implementing Page Objects pattern.
Ruby
81
star
3

win32screenshot

Capture Screenshots on Windows with Ruby
Ruby
70
star
4

hackersays

SCSS
52
star
5

secrets-web

Not Yet Another Password Manager self-hosted Web app written in Go using libsodium
Go
38
star
6

secrets

Not Yet Another Password Manager written in Go using libsodium
Go
28
star
7

WatirSplash

Combining best features of Watir and RSpec for browser-based functional testing.
Ruby
25
star
8

backpocket

Backpocket is a command line utility for storing a reading list of articles from the Internet to your local disk for the future. It's an alternative to Pocket offering all the required features without handing over all your private reading materials to any 3rd party.
Go
10
star
9

secrets-cli

Not Yet Another Password Manager CLI interface written in Go using libsodium
Go
10
star
10

expand-aliases-oh-my-zsh

expand-aliases plugin for oh-my-zsh
Shell
5
star
11

autotest-doom

autotest plugin for showing bloody Doom grunt when specs are failing
Ruby
3
star
12

extreme_startup

Ruby
1
star
13

authorize_action

Really secure and simple authorization library for your Rails, Sinatra or whatever web framework, which just works.
Ruby
1
star
14

PMDb

Personal Movie Database
JavaScript
1
star
15

spork-local_process

Ruby
1
star
16

IT-Really-Matters-blog

Project files for blog entries
Ruby
1
star
17

eventify

Eventify will notify you about upcoming events from different providers/organizers.
HTML
1
star
18

watir-page-helper

This is a page helper for Watir/Watir-WebDriver that allows use easy access to elements.
Ruby
1
star
19

candalf

Candalf is a simple tool that helps to orchestrate Linux and Unix-like system configuration/setup/management using SSH
Shell
1
star
20

dotfiles

Shell
1
star