I worry about a one thing however.

In each loop iteration I see you open a new browser instance, but I
never see you close a browser.. so expect you are going to open a lot
of browsers and potentially you could have quite a mess on your hands
(or run the system out of memory), if the test runs for a good number
of iterations..  You may want to consider adding a command to close
the browser at the end of the same loop where it is opened, or else
move creating (and later closing) the IE instance outside of your
loop.

2) minor style thing, but I see most ruby coders express loops like
are doing without the curley braces, and just use the form

 variable.each do |i|
   code
   code
 end

the preference seems to be to use the curley brace notation only for
single line stuff such as

variable.each { |i| codeusing i }

Also for variable names, the most common thing I've seen is

  variable = all_lowercase
  constant = ALL_UPPERCASE
  classes = CamelCase

you're free to code anyway that works of course, but it might be
slightly less confusing to others (when you have code reviewed or ask
for assistance) to be slightly more 'mainstream'.   I've always
figured that the easier it was for other folks to read my code the
better when it came time to ask for help.  Also that means less
chances for non-answers where say someone thinks 'testCase' is a class
and responds accordingly.



On Apr 12, 1:15 pm, Chai Taolun <ctco...@gmail.com> wrote:
> Hi~
>
> Thank you alex!
> I got it. thank you so much.
>
> allen
> On Sun, Apr 12, 2009 at 9:00 AM, Alex Collins <a.j.collins...@gmail.com>wrote:
>
>
>
>
>
> > I believe that the issue is that you are passing in an Array into goto,
> > when it expects a string:http://wtr.rubyforge.org/rdoc/- look at the
> > Watir::IE class' goto method.
>
> > You create an array on the following line:
> > thisLocation = folderLocation, i
>
> > Explicitly stated, you can read this as:
> > thisLocation = [folderLocation, i]
>
> > thisLocation is therefore an Array. To convert this to a string, simply
> > call the "to_s" method on the array. For example:
>
> > [1, 2].to_s => "12"
>
> > ["c:\\file\\", "foo.bar"].to_s => "c:\\file\\foo.bar"
>
> > You therefore need to amend your script so that you call:
> > ie.goto(thisLocation.to_s)
>
> > However, if you are looking to join file names to directory paths, I
> > suggest you look at Ruby's File and Dir classes. They have many useful
> > helpers, for example, File.join does exactly what we are doing above, but in
> > a platform-safe manner.
>
> > Alex
>
> > On 12 Apr 2009, at 02:57, Chai Taolun wrote:
>
> > Hi~
> > Sorry, this is not like that, I want to visit some webpage using the name I
> > store in the text file.
> > I need to find a way to do this.
> > Thank you
>
> > allen
>
> > On Sat, Apr 11, 2009 at 1:22 PM, kiran <gki...@gmail.com> wrote:
>
> >> Hi,
> >> I think problem with folder path.
> >> suppose if we want open a file located in D:\watir
> >> The statement for watir
> >> ie.goto("D:\\watir")
>
> >> it would help you.
>
> >> On Apr 11, 12:15 pm, Chai Taolun <ctco...@gmail.com> wrote:
> >> > Hi~
>
> >> > Ruby is new to me and I got this problem in this code. Could you give me
> >> > some help? Thank you
>
> >> > infile.each{
> >> >   |i|
> >> >   thisLocation = folderLocation, i
> >> >   print thisLocation
> >> >   k =testCaseNumber
> >> >   while k !=0
> >> >     ie = Watir::IE.new
> >> >     ie.goto(thisLocation)
>
> >> > and here is the error
> >> > c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb:358:in
> >> > `method_missing': navigate (WIN32OLERuntimeError)
> >> >     OLE error code:0 in <Unknown>
> >> >       <No Description>
> >> >     HRESULT error code:0x80020005
> >> >       Type mismatch.    from
> >> > c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb:358:in
> >> > `goto'
> >> >     from awat.rb:61
> >> >     from awat.rb:54:in `each'
> >> >     from awat.rb:54http://localhost:81/Homework/HswitchS.php>Exit code:
> >> 1
>
> >> > Thank you so much and looking forward your help ^_^
>
> >> > Allen
> >> > --
> >> > There are some things in this world will never change and some things do
> >> > change.
>
> > --
> > There are some things in this world will never change and some things do
> > change.
>
> --
> There are some things in this world will never change and some things do
> change.- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to