Send Text w/ Ruby

M

Matthew Barnes

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!
 
E

Eric Christopherson

I'm curious if it is possible to send text to a window or web
application. =A0I 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. =A0Thanks!

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.ht=
ml>
 
J

James Britt

Eric said:
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 Britt

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
 
Q

Quintus

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

Am 05.08.2010 08:05, schrieb James Britt:
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-----
 
R

Roger Pack

Matthew said:
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
 
T

The NaztyBoys

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

Am 05.08.2010 08:05, schrieb James Britt:




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

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 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.
 
T

The NaztyBoys

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

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.
 
M

Matthew Barnes

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

Am 05.08.2010 08:05, schrieb James Britt:




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

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 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!
 
M

Matthew Barnes

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!
 
J

John W Higgins

[Note: parts of this message were removed to make it a legal post.]

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
 
M

Matthew Barnes

[Note:  parts of this message were removed to make it a legal post.]

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,146
Messages
2,570,832
Members
47,374
Latest member
EmeliaBryc

Latest Threads

Top