Sha256: d7e7735cde5f011175d9fbc666cf7a9f29a144395f3ab83ee364db47f64805cf

Contents?: true

Size: 862 Bytes

Versions: 6

Compression:

Stored size: 862 Bytes

Contents

#---
# Excerpted from "Scripted GUI Testing With Ruby",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material, 
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose. 
# Visit http://www.pragmaticprogrammer.com/titles/idgtr for more book information.
#---
require 'win32/guitest'
require 'win32/guitest_svn' #(1)

include Win32::GuiTest

system 'start "" "C:/Windows/System32/notepad.exe"'
sleep 1

w = findWindowLike(nil, /^Untitled - Notepad$/).first
w.sendkeys 'This is some text'
w.sendkeys ctrl('a')
w.sendkeys 'And this is its replacement'

e = w.children.find {|c| c.classname == 'Edit'}
puts e.windowText #(2)

w.sendkeys alt(key('F4'))
sleep 0.5

d = findWindowLike(nil, /^Notepad$/).first
d.sendkeys 'n'

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
win_gui-0.1.6 book_code/windows/wgui.rb
win_gui-0.1.4 book_code/windows/wgui.rb
win_gui-0.1.3 book_code/windows/wgui.rb
win_gui-0.1.2 book_code/windows/wgui.rb
win_gui-0.1.1 book_code/windows/wgui.rb
win_gui-0.1.0 book_code/windows/wgui.rb