[Wtr-development] new window automation library: WinWindow
jarmo.p at gmail.com
Thu Sep 2 07:13:41 EDT 2010
I've taken a glimpse on that thing now. Really, a glimpse.
First of all, i think that it's somehow great if something else (ffi
in this case) is used instead of AutoIt. On the other hand with AutoIt
a lot of problems are already solved. So there are two sides for this
It's great that it is nicely documented :)
>From a developer's view i don't like that (almost) all the code is in
one file with 1365 lines. Why?
As a user's view i looked at the API and it seems to be really-really
(i mean, really) confuzing. For example, there are methods like
#set_foreground! and #really_set_foreground!. Like, what?
On another note, i've been lately producing some code using AutoIt
since it is nicely integrated with current Watir. I'm being able to
produce quite robust and effective results with it. I don't see many
benefits of using something else currently (yup, you cannot use
everything with AutoIt on locked workstation, but this is also true
for FFI and something similar). Anyway, i'm planning to make it as a
gem also probably.
Sorry, if i'm not able to see the big picture.
Keep up the good work!
On Wed, Sep 1, 2010 at 6:35 PM, Ethan <notethan at gmail.com> wrote:
> I've released a gem for a ruby library that I hope people will find useful,
> and I believe will be of interest to those using watir. The library is
> called WinWindow, and its aim is to represent a window (such as an IE
> object-oriented, ruby-like way.
> The project's site is at http://winwindow.vapir.org/
> It was borne of frustration with winClicker and AutoIt, and I wrote it to
> replace, improve, and expand on functionality that watir currently uses
> those libraries for. Namely, interaction with modal dialogs (getting text,
> entering text, clicking buttons, closing); maximizing/focusing windows;
> dealing with File Upload dialogs. It also does screen captures, which I
> implemented because the win32screenshot gem was broken, although Jarmo has
> since fixed that gem.
> $ irb -r watir
>>> require 'winwindow'
> => true
> # launch a new browser
> => #<Watir::IE:0x36fece8 url="about:blank" title="">
> # create a WinWindow representing the browser
> => #<WinWindow:0x36e3688 @text="Blank Page - Windows Internet Explorer",
> @hwnd=395016, @class_name="IEFrame">
> => 2.953125
> # click the button to create the popup
>>> ie.button(:value, /alert/).click_no_wait
> => ""
> # see if the popup is on the window
> => #<WinWindow:0x3642810 @text="Windows Internet Explorer", @hwnd=15076272,
> # click the "OK" button on the popup. the 'try_for' part tells it how many
> # seconds to try, because sending click messages through the windows API is
> # not very reliable and just doing it once tends to fail.
>>> w.enabled_popup.click_child_button_try_for!('OK', 4)
> => true
> # popup is gone.
> tl;dr version: to click on a button on ie's popup with text button_text
> (trying for n seconds), you can use
> I hope you'll give it a try and let me know what you think.
> Wtr-development mailing list
> Wtr-development at rubyforge.org
More information about the Wtr-development