Thanks for your solution. now it works well.

unless defined?(Ocra)
.....code
end

 if not defined?(Ocra)
  ....code
 end

On Aug 4, 5:35 pm, Jarmo Pertman <jarm...@gmail.com> wrote:
> You can do it like this. Just make sure that all require statements
> are outside of that unless block:
>
> require 'rubygems'
> require 'watir'
> require 'watir/ie'
>
> unless defined?(Ocra)
>
> ie = Watir::IE.new
> ie.speed =:fast
> for i in 1..10000
> ie.goto 'http://www.google.com'
> ie.text_field(:name, 'q').set('hello world')
> ie.button(:name, 'btnG').click
> end
>
> end
>
> On Aug 4, 4:01 am, "Alex.Dev" <btb8...@gmail.com> wrote:
>
> > thanks for your quickly reply.
> > yep, the code seems meanningless. But it's only a dummy of my working
> > script, sorry for that i coldn't put my real script to here.
> > My real script really have a very big loop to test all pages, but i
> > don't the total page count, so i only can do it by click the linke
> > 'next page'.
> > Now i want to convert it through Ocra, Is there any good solution?
> > Regards,
>
> > On Aug 4, 3:25 am, Richard Wijdenes <richard.wijde...@gmail.com>
> > wrote:
>
> > > Hey Alex,
>
> > > First of all, I think it is a very strange peace of code. You're not
> > > checking anything, just clicking etc.
> > > Why 10000 times? Do you want to use Watir as a performance tool?
>
> > > Furthermore, google does not like these scripts. You (or your IP
> > > number) will probably get on a blacklist if you do this often.
>
> > > Ocra first tries to carry out the entire script before making the exe
> > > file. So why don't you use a commandline argument to start your
> > > script?
> > > So if you want it to execute 10 times, you type alex.exe (or just
> > > alex) 10.
>
> > > Grtz.R.
--~--~---------~--~----~------------~-------~--~----~
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