Send Text w/ Ruby

I’m curious if it is possible to send text to a window or web
application. I am using the firewatir library, but I don’t think you
can do it with that, so just wondering if it is possible with Ruby
itself. Thanks!

On Wed, Aug 4, 2010 at 9:35 PM, Matthew B. [email protected]
wrote:

I’m curious if it is possible to send text to a window or web
application. I am using the firewatir library, but I don’t think you
can do it with that, so just wondering if it is possible with Ruby
itself. Thanks!

On Windows, you can use Win32::GuiTest
http://raa.ruby-lang.org/project/win32-guitest/.

I haven’t tried it, though. Here are some instructions on building it
as a gem (it isn’t available from Rubygems itself):
http://gware.blogspot.com/2009/09/building-win32-guitest-gem-on-windows.html

Eric C. wrote:

On Wed, Aug 4, 2010 at 9:35 PM, Matthew B. [email protected] wrote:

I’m curious if it is possible to send text to a window or web
application. I am using the firewatir library, but I don’t think you
can do it with that, so just wondering if it is possible with Ruby
itself. Thanks!

On Windows, you can use Win32::GuiTest
http://raa.ruby-lang.org/project/win32-guitest/.

AutoItX is also very handy for scripting Windows apps and the Win32 API.

See
http://groups.google.com.kh/group/ruby-talk-google/msg/ca78a0fcf1015a05

for an earlier post I made on this.


James B.

www.jamesbritt.com - Playing with Better Toys
www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff
www.neurogami.com - Smart application development

Matthew B. wrote:

I’m curious if it is possible to send text to a window or web
application. I am using the firewatir library, but I don’t think you
can do it with that, so just wondering if it is possible with Ruby
itself. Thanks!

watir itself can populate fields, can it not?
-r

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 05.08.2010 08:05, schrieb James B.:

AutoItX is also very handy for scripting Windows apps and the Win32 API.

See http://groups.google.com.kh/group/ruby-talk-google/msg/ca78a0fcf1015a05

for an earlier post I made on this.

If I’m allowed to promote myself…
I wrote a library wrapped around AutoItX3, available as the au3 gem[1].
For Linux systems I wrote xdo (based on the xdotool commandline tool),
but that’s undergoing a heavy rework at the moment.

Vale,
Marvin

[1] See also http://auto.rubyforge.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxaaBgACgkQDYShvwAbcNmf/wCgnRCEOUPriSy3hqXSrzx5Hxci
rywAoJEw1spMEuj1mtqR1qvrMzvc1706
=xzxV
-----END PGP SIGNATURE-----

On Aug 5, 1:28 am, Quintus [email protected] wrote:

On Wed, Aug 4, 2010 at 9:35 PM, Matthew B.

Marvin

[1] See alsohttp://auto.rubyforge.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/

iEYEARECAAYFAkxaaBgACgkQDYShvwAbcNmf/wCgnRCEOUPriSy3hqXSrzx5Hxci
rywAoJEw1spMEuj1mtqR1qvrMzvc1706
=xzxV
-----END PGP SIGNATURE-----

Thanks Marvin! I’ll have to check out your xdo tool as I am on a
linux box.

On Aug 5, 9:15 am, Roger P. [email protected] wrote:

Matthew B. wrote:

I’m curious if it is possible to send text to a window or web
application. I am using the firewatir library, but I don’t think you
can do it with that, so just wondering if it is possible with Ruby
itself. Thanks!

watir itself can populate fields, can it not?
-r

Posted viahttp://www.ruby-forum.com/.

Yes it can, but the fields in are encrypted in the html source, so it
is a random string each time you load the page. I am using ruby on a
linux box right now, but I guess if my only options are the windows
api I may have to run a virtual machine.

On Aug 5, 9:15 am, Roger P. [email protected] wrote:

Matthew B. wrote:

I’m curious if it is possible to send text to a window or web
application. I am using the firewatir library, but I don’t think you
can do it with that, so just wondering if it is possible with Ruby
itself. Thanks!

watir itself can populate fields, can it not?
-r

Posted viahttp://www.ruby-forum.com/.

It can, but the tags for these fields are encrypted, so every time the
page loads its a different random string!

On Aug 5, 1:28 am, Quintus [email protected] wrote:

On Wed, Aug 4, 2010 at 9:35 PM, Matthew B.

Marvin

[1] See alsohttp://auto.rubyforge.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/

iEYEARECAAYFAkxaaBgACgkQDYShvwAbcNmf/wCgnRCEOUPriSy3hqXSrzx5Hxci
rywAoJEw1spMEuj1mtqR1qvrMzvc1706
=xzxV
-----END PGP SIGNATURE-----

I am on a linux box so the win32 api wont work or autoit, but I will
def check out your xdo tool! Thanks!

On Aug 5, 10:53 am, John W Higgins [email protected] wrote:

via Firewatir.

John

Wow, I did not know this, thanks for the info John! I will def check
this out.

On Thu, Aug 5, 2010 at 9:45 AM, Matthew B.
[email protected]wrote:

On Aug 5, 9:15 am, Roger P. [email protected] wrote:

watir itself can populate fields, can it not?
-r

It can, but the tags for these fields are encrypted, so every time the
page loads its a different random string!

Have you looked at the page with Firebug/Firefinder to see if any
pattern
can locate the fields? Firewatir doesn’t specifically need to know the
name
of the field you want to fill in.

As an example, if the field is located inside the same div every time
then
you can walk down to it using the div and then grab the only field
inside
the div. That would work the same if it was in the 3rd row of a table
every
time or any other concept that can be specified to Firewatir.

For certain (well 95%+), if you can XPath the field then you can get to
it
via Firewatir.

John