Watir

I been teaching myself Ruby for three months now and
I’ve needed very Little help until now. I’ve been
working with text files using strings, array’s, hash’s
and CSV all with Little problem

Now I’ve moved onto using the watir gem with no luck.
Unless I open www.yahoo.com or www.google.com I get
frame errors or the code will not exit. Am I just
missing something basic. Code same below.

#ie = Watir::IE.start(“http://www.yahoo.com/”) #works
#ie = Watir::IE.start(“http://tv.yahoo.com/”) #no exit
#ie =
Watir::IE.start(“http://finance.yahoo.com/”)#frame
error
ie = Watir::IE.start(“http://www.nascar.com/”) #no
exit

Jeff

Umm, did you require watir first?

Like this…

require ‘watir’
$ie=Watir::IE.start(“http://www.google.com”)
$ie.text_field(:index,1).set(“watir mailing list”)
$ie.button(:value,/Seach/).click

But it helps if you spell correctly…

mysource.sub!(‘Seach’,‘Search’)

On Aug 9, 10:44 am, Jeffrey B. [email protected] wrote:

#ie = Watir::IE.start(“http://www.yahoo.com/”) #works
Sick sense of humor? Visit Yahoo! TV’s
Comedy with an Edge to see what’s on, when.http://tv.yahoo.com/collections/222

require ‘watir’
include Watir

ie = IE.new
ie.goto(‘http://finance.yahoo.com/’)

This works for me.
Luis

Luis,
Out of curiosity, have you found much advantage to including the
“include Watir” line?
Since it pretty much only saves me having to type “Watir::”, and I
only type that once, I almost always omit the include.

–Kyle

On Aug 9, 3:58 pm, “Kyle S.” [email protected] wrote:

Luis,
Out of curiosity, have you found much advantage to including the
“include Watir” line?
Since it pretty much only saves me having to type “Watir::”, and I
only type that once, I almost always omit the include.

–Kyle

That’s the only real advantage. Of course in a script this short it is
not very useful. But in a longer script you may save a little time.

Luis

Thanks I’ll check the version I’m running. That’s
the only other thing I can think of.

Jeff
— “[email protected][email protected] wrote:

luck.

error
ie = Watir::IE.start(“http://www.nascar.com/”) #no
exit

Jeff


This works for me.
Luis

____________________________________________________________________________________Ready
for the edge of your seat?
Check out tonight’s top picks on Yahoo! TV.

Jeffrey B. wrote:

Thanks I’ll check the version I’m running. That’s
the only other thing I can think of.

Jeff

This is kind of a side question…

I’ve used win32ole for kicking off IE before. What the advantage of
using watir, or is there one?

Thanks, Todd

On Aug 9, 9:31 pm, Todd B. [email protected] wrote:

Thanks, Todd


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

watir provides a nicer interface than useing ie/ole directly
You will also be able to run your code against firefox with only a
minimal number of changes.

Paul

When writing portable code, it is extremely helpful to include the full
namespace. I try to avoid using the include statement so that the code
is more portable and readable.