Re: [Wtr-general] Want to display data in the same row using Puts

2007-06-13 Thread Angrez Singh

Hi,

The question you asked was related to Ruby and not to Watir. I think you
should start reading the book "Programming Ruby". It will be there in your
installation directory i.e. where you have installed ruby.

- Angrez

On 6/14/07, sapna <[EMAIL PROTECTED]> wrote:


Thanks a lot Zeljko. Is there any book to refer regarding WATIR for
beginner.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Want to display data in the same row using Puts

2007-06-13 Thread sapna
Thanks a lot Zeljko. Is there any book to refer regarding WATIR for beginner.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] OT: ruby/eclipse question

2007-06-13 Thread Jeff Fry

Thanks Jason,

Normally I do that, but I didn't with this one because when I created it 
it was a Python project. That said - I found the solution. I went 
exploring again and found the amusingly straightforward Project > Add 
Ruby Nature...which did the trick.


It leaves me wondering what a project nature in eclipse is, and what it 
means for a project to have more than one nature. Definitely one of the 
most metaphysical roadblocks I've stumbled across in recent months.


Jeff "Off looking for 'Add Buddha Nature 
'" Fry


Jason Darling wrote:

Hey Jeff,
 
Make sure when you create your project, that it's a Ruby Project.  You 
check out it out from svn and then create your project/workspace as a 
Ruby project.  There is a little "ruby" icon that shows up for .rb 
files if this is done.  Are you seeing this?
 
Cheers,

Jason

-Original Message-
*From:* [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of *Jeff Fry
*Sent:* Wednesday, June 13, 2007 8:19 PM
*To:* wtr-general@rubyforge.org
*Subject:* [Wtr-general] OT: ruby/eclipse question

Hey, I know a few of y'all use Eclipse so I figured its worth a
shot to ask this here.

The shop I'm working for has a bunch of (non-GUI) automation
written in Python, to which I'll be adding some GUI scripts
written in Ruby/Watir.

There is an existing svn repository like
https://OurSVNrepository.com/svn/mwtest/trunk/misc


I added a /mwtest/trunk/misc/watir folder to the project and tried
to save my .rb file there, but eclipse is complaining:
Save could not be completed.
Reason: The project trunk is supposed to have a ruby nature.

Googling: "The project trunk is supposed to have a" nature. gets
me 0 results. Do I need to create a separate project for my ruby
scripts? Can I somehow give this project a 'dual nature'?

I should note that I have RDT 0.9.0 installed, and have a project
for the watir project here that works just fine (I can save to
https://svn.openqa.org/svn/watir/trunk/watir
) so my eclipse
setup in general shouldn't be the issue.

Thanks,
Jeff

-- 
http://testingjeff.wordpress.com 




___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] OT: ruby/eclipse question

2007-06-13 Thread Charley Baker

Hey Jeff,

You can create a .project file at the root of your project directory and
put this in it - replace project_name with your project name.



   project_name
   
   
   
   
   
   org.rubypeople.rdt.core.rubybuilder
   
   
   
   
   
   org.rubypeople.rdt.core.rubynature
   



-Charley

On 6/13/07, Jason Darling <[EMAIL PROTECTED]> wrote:


 Hey Jeff,

Make sure when you create your project, that it's a Ruby Project.  You
check out it out from svn and then create your project/workspace as a Ruby
project.  There is a little "ruby" icon that shows up for .rb files if
this is done.  Are you seeing this?

Cheers,
Jason

-Original Message-
*From:* [EMAIL PROTECTED] [mailto:
[EMAIL PROTECTED] Behalf Of *Jeff Fry
*Sent:* Wednesday, June 13, 2007 8:19 PM
*To:* wtr-general@rubyforge.org
*Subject:* [Wtr-general] OT: ruby/eclipse question

Hey, I know a few of y'all use Eclipse so I figured its worth a shot to
ask this here.

The shop I'm working for has a bunch of (non-GUI) automation written in
Python, to which I'll be adding some GUI scripts written in Ruby/Watir.

There is an existing svn repository like 
https://OurSVNrepository.com/svn/mwtest/trunk/misc


I added a /mwtest/trunk/misc/watir folder to the project and tried to save
my .rb file there, but eclipse is complaining:
Save could not be completed.
Reason: The project trunk is supposed to have a ruby nature.

Googling: "The project trunk is supposed to have a" nature. gets me 0
results. Do I need to create a separate project for my ruby scripts? Can I
somehow give this project a 'dual nature'?

I should note that I have RDT 0.9.0 installed, and have a project for the
watir project here that works just fine (I can save to 
https://svn.openqa.org/svn/watir/trunk/watir
) so my eclipse setup in general shouldn't be the issue.

Thanks,
Jeff

--
http://testingjeff.wordpress.com


___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] OT: ruby/eclipse question

2007-06-13 Thread Jason Darling
Hey Jeff,

Make sure when you create your project, that it's a Ruby Project.  You check
out it out from svn and then create your project/workspace as a Ruby
project.  There is a little "ruby" icon that shows up for .rb files if this
is done.  Are you seeing this?

Cheers,
Jason
  -Original Message-
  From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Jeff Fry
  Sent: Wednesday, June 13, 2007 8:19 PM
  To: wtr-general@rubyforge.org
  Subject: [Wtr-general] OT: ruby/eclipse question


  Hey, I know a few of y'all use Eclipse so I figured its worth a shot to
ask this here.

  The shop I'm working for has a bunch of (non-GUI) automation written in
Python, to which I'll be adding some GUI scripts written in Ruby/Watir.

  There is an existing svn repository like
https://OurSVNrepository.com/svn/mwtest/trunk/misc

  I added a /mwtest/trunk/misc/watir folder to the project and tried to save
my .rb file there, but eclipse is complaining:
  Save could not be completed.
  Reason: The project trunk is supposed to have a ruby nature.

  Googling: "The project trunk is supposed to have a" nature. gets me 0
results. Do I need to create a separate project for my ruby scripts? Can I
somehow give this project a 'dual nature'?

  I should note that I have RDT 0.9.0 installed, and have a project for the
watir project here that works just fine (I can save to
https://svn.openqa.org/svn/watir/trunk/watir ) so my eclipse setup in
general shouldn't be the issue.

  Thanks,
  Jeff

  --
  http://testingjeff.wordpress.com
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] OT: ruby/eclipse question

2007-06-13 Thread Jeff Fry

Hey, I know a few of y'all use Eclipse so I figured its worth a shot to ask
this here.

The shop I'm working for has a bunch of (non-GUI) automation written in
Python, to which I'll be adding some GUI scripts written in Ruby/Watir.

There is an existing svn repository like
https://OurSVNrepository.com/svn/mwtest/trunk/misc

I added a /mwtest/trunk/misc/watir folder to the project and tried to save
my .rb file there, but eclipse is complaining:
Save could not be completed.
Reason: The project trunk is supposed to have a ruby nature.

Googling: "The project trunk is supposed to have a" nature. gets me 0
results. Do I need to create a separate project for my ruby scripts? Can I
somehow give this project a 'dual nature'?

I should note that I have RDT 0.9.0 installed, and have a project for the
watir project here that works just fine (I can save to
https://svn.openqa.org/svn/watir/trunk/watir
) so my eclipse setup in general shouldn't be the issue.

Thanks,
Jeff

--
http://testingjeff.wordpress.com
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Save results to file

2007-06-13 Thread Adam Reed
I don't know what's up with the formatting, the "end #ie.links.each"
should be on the next line (or else it'll get tied into the previous
comment). 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Adam Reed
Sent: Wednesday, June 13, 2007 2:24 PM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Save results to file

I'm not sure what you're trying to say -- you lost me here.

If you want to scrape a page for URLs and then write them to the log
file:

ie.links.each do |link|  # for each link on the current page in IE...
 textlog.puts link.src  # print url of the link in the textlog we
created end #ie.links.each

Otherwise, please include the purpose of your script and the html from
the page you're testing.

Thanks,
Adam

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of B Smith
Sent: Wednesday, June 13, 2007 2:17 PM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Save results to file

Thanks,
The File Create worked...But How do I d'l all the hyperink to the file?

I.E. I thought of ie.put(:text,)

But, this syntax is more of a 'push' and I'm trying to 'pull' the result
data (i.e. scrape results and iterate thru the results into a file) so I
know it is wrong before I even tried it

-from watir online tutorial- Text Attribute This is the
Watir code you need to click a hyperlink using the text attribute:
ie.link(:text, "Pickaxe").click

What you see in the HTML source (attribute highlighted):
-end snippet---
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Save results to file

2007-06-13 Thread Adam Reed
I'm not sure what you're trying to say -- you lost me here.

If you want to scrape a page for URLs and then write them to the log
file:

ie.links.each do |link|  # for each link on the current page in IE...
 textlog.puts link.src  # print url of the link in the textlog we
created
end #ie.links.each

Otherwise, please include the purpose of your script and the html from
the page you're testing.

Thanks,
Adam

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of B Smith
Sent: Wednesday, June 13, 2007 2:17 PM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Save results to file

Thanks,
The File Create worked...But How do I d'l all the hyperink to the file?

I.E. I thought of ie.put(:text,)

But, this syntax is more of a 'push' and I'm trying to 'pull' the result
data (i.e. scrape results and iterate thru the results into a file) so I
know it is wrong before I even tried it

-from watir online tutorial- Text Attribute This is the
Watir code you need to click a hyperlink using the text attribute:
ie.link(:text, "Pickaxe").click

What you see in the HTML source (attribute highlighted):
-end snippet---
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Save results to file

2007-06-13 Thread B Smith
Thanks,
The File Create worked...But How do I d'l all the hyperink to the file?

I.E. I thought of ie.put(:text,)

But, this syntax is more of a 'push' and I'm trying to 'pull' the result data 
(i.e. scrape results and iterate thru the results into a file) so I know it is 
wrong before I even tried it

-from watir online tutorial-
Text Attribute
This is the Watir code you need to click a hyperlink using the text attribute:
ie.link(:text, "Pickaxe").click

What you see in the HTML source (attribute highlighted):
-end snippet---
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Save results to file

2007-06-13 Thread Adam Reed
There are quite a few other steps that I'm skipping because they're
pretty easy to google (checking if a log file exists already, appending
the log name with the date to preven overwrites, etc), but here's a real
simple intro:

textlog = File.open("text.log",
File::CREAT|File::APPEND|File::WRONLY)

This creates a file named text.log in the root directory.  The flags at
the end tell it to create the file it if doesn't exist, append the file
if it already exists, and allow write access.

Now, when you want to write something to the log, you use:

textlog.puts "Here's some stuff"

I store my logging function in a separate library and call it at the
beginning of each test, and then call a separate function that enters
some formatting for the end of the log at the end of each test.  I just
use simple formatting like "##  " at the beginning of every heading line
to make the important information easier to read.

Hope that helps,
Adam

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of B Smith
Sent: Wednesday, June 13, 2007 1:36 PM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] Save results to file

Pls be patient. I just d/l'd Watir and am just starting...

I used this .rb from the tutorial of Watir -snippet
start--
require 'watir'   # the watir controller

   # set a variable
   test_site = 'http://www.google.com'
  
   # open the IE browser
   ie = Watir::IE.new

   # print some comments
   puts "## Beginning of test: Google search"
   puts "  "
  
   puts "Step 1: go to the test site: " + test_site
   ie.goto(test_site)
   puts "  Action: entered " + test_site + " in the address bar."

   puts "Step 2: enter 'pickaxe' in the search text field"
   ie.text_field(:name, "q").set("Beer + Bottle + Label")   # q is
the name of the search field
   puts "  Action: entered pickaxe in the search field"

   puts "Step 3: click the 'Google Search' button"
   ie.button(:name, "btnG").click   
# "btnG" is the name of the Search button
   puts "  Action: clicked the Google Search button."

   puts "Expected Result: "
   puts " - a Google page with results should be shown. 'Programming
Ruby' should be high on the list."
  
   puts "Actual Result: Check that the 'Programming Ruby' link appears
on the results page "
   if ie.contains_text("Programming Ruby")  
  puts "Test Passed. Found the test string: 'Programming Ruby'.
Actual Results match Expected Results."
   else
  puts "Test Failed! Could not find: 'Programming Ruby'" 
   end
   
   puts "  "
   puts "## End of test: Google search"
  --end snippet--

It opens the window and performs the search.

NOW...How do I save the text of the results to a file? I will eventually
want to save the results to a MySQL tble, but I'm trying baby steps to
learn the syntax.

Thanks,
B
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Microsoft Tab Strip Issues - urgent

2007-06-13 Thread Bret Pettichord
This looks like an ActiveX control. I don't know how to handle ActiveX 
controls with Watir. Can you point us to a page that includes this control?

Bret

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Save results to file

2007-06-13 Thread B Smith
Pls be patient. I just d/l'd Watir and am just starting...

I used this .rb from the tutorial of Watir
-snippet start--
require 'watir'   # the watir controller

   # set a variable
   test_site = 'http://www.google.com'
  
   # open the IE browser
   ie = Watir::IE.new

   # print some comments
   puts "## Beginning of test: Google search"
   puts "  "
  
   puts "Step 1: go to the test site: " + test_site
   ie.goto(test_site)
   puts "  Action: entered " + test_site + " in the address bar."

   puts "Step 2: enter 'pickaxe' in the search text field"
   ie.text_field(:name, "q").set("Beer + Bottle + Label")   # q is the name 
of the search field
   puts "  Action: entered pickaxe in the search field"

   puts "Step 3: click the 'Google Search' button"
   ie.button(:name, "btnG").click   
# "btnG" is the name of the Search button
   puts "  Action: clicked the Google Search button."

   puts "Expected Result: "
   puts " - a Google page with results should be shown. 'Programming Ruby' 
should be high on the list."
  
   puts "Actual Result: Check that the 'Programming Ruby' link appears on the 
results page "
   if ie.contains_text("Programming Ruby")  
  puts "Test Passed. Found the test string: 'Programming Ruby'. Actual 
Results match Expected Results."
   else
  puts "Test Failed! Could not find: 'Programming Ruby'" 
   end
   
   puts "  "
   puts "## End of test: Google search"
  --end snippet--

It opens the window and performs the search.

NOW...How do I save the text of the results to a file? I will eventually want 
to save the results to a MySQL tble, but I'm trying baby steps to learn the 
syntax.

Thanks,
B
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] NoMethodError :Undefined method "Process_id" for 1808:Fixnum

2007-06-13 Thread Bret Pettichord
Simba wrote:
> When i Run Below is code in IRB ,its throwinf error 
> require 'watir'
> ie=Watir::IE.start("www.google.com")
>
> Error :
> NoMethodError :Undefined method "Process_id" for 1808:Fixnum
>
> Please some body tell me why this error is coming?
>
> Before Going into IRB , I had installed Win32-process 0.4.0 & 
> Watir-1.5.1.1158.gem
>   
Could you please provide a stack trace?
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Upgrading the gem for watir 1.5.1.1192

2007-06-13 Thread Bret Pettichord
imran wrote:
> But there is another query.
>   
If you have a new question, please submit it under a (different) subject 
line that describes the problem.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Best Combination of Ruby and Watir

2007-06-13 Thread Bret Pettichord
Željko Filipin wrote:
> On 6/8/07, *Bret Pettichord* <[EMAIL PROTECTED] 
> > wrote:
> I just installed ruby182-14.exe on clean xp pro machine. Components: 
> only RubyGems Package Manager. Then I tried to install 
> watir-1.5.1.1192.gem. I first executed
>
> Y:\>gem install win32-process --include-dependencies
>
> and got this error message.
>
> Y:\>"c:\ruby\bin\ruby.exe" "c:\ruby\bin\gem" install win32-process 
> --include-dep
> endencies
> ERROR:  While executing gem ... (OptionParser::InvalidOption)
> invalid option: --include-dependencies
>
> I uninstalled ruby182-14.exe and installed ruby182-15.exe and did not 
> get that error message. Am I doing something wrong?
Probably not. My guess is that you have run into a problem with the 
version of rubygems installed with 182-14. What happens if you don't use 
the "--include-dependencies" option?

Bret
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] how to properly use the snippet function?

2007-06-13 Thread Bill Agee
When I needed to use that snippet, I just left the whole thing in a
separate file, and initiated the cache/cookie cleanup with
system('ruby del_cache.rb')

You could also probably paste the whole blob of code into a new method
and it should work.

It would be possible to do the same work in fewer lines of code, but
you'd have to refactor the script somewhat.



On 6/13/07, reinier <[EMAIL PROTECTED]> wrote:
> I am trying to get rid of all cookies via a function.
> On this forum I found the Snippet thingy.
> http://rubyforge.org/snippet/detail.php?type=snippet&id=26
> So I included that code in my script and trying to use it, but I can't figure 
> out how.
>
> this is the code:
> [code]
> DeleteUrlCacheEntry = Win32API.new("wininet", "DeleteUrlCacheEntry", ['P'], 
> 'V')
> [/code]
>
> So what function should be called to delete all the cookies?
> ___
> Wtr-general mailing list
> Wtr-general@rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Microsoft Tab Strip Issues - urgent

2007-06-13 Thread imran
Hi, All

I am working on writing the scripts for my web application but the problem is 
that i am unable to locate the object named Microsoft Tab strip. Code is like 
that


http://zaigham/webctrl_client/1_0/tabstrip.htc"; DECLARENAMESPACE 
/>



Patient Info



*Insurance Info*



*Admission Info*





I did try the method to get the url of the respective tab and send it to that 
location but in vain due to the serverside session creation which is the part 
of the URL. Some session number dynamically generated is part of that URL. So 
when i use that approach it says session expired/ no such session exists.
I have to click the Admisison Info tab.

Please suggest some solution to resolve this burning issue.

Thanks 

kind Regards,
M.Imran
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Carl L Shaulis is out of the office.

2007-06-13 Thread carl . l . shaulis




I will be out of the office starting  06/13/2007 and will not return until
06/14/2007.

If you need immediate assistance please try Cari Spruiell or my cell  phone
at 512-560-5773.  Thanks!
--
"NOTICE:  The information contained in this electronic mail transmission is
intended by Convergys Corporation for the use of the named individual or
entity to which it is directed and may contain information that is
privileged or otherwise confidential.  If you have received this electronic
mail transmission in error, please delete it from your system without
copying or forwarding it, and notify the sender of the error by reply email
or by telephone (collect), so that the sender's address records can be
corrected."

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] how to properly use the snippet function?

2007-06-13 Thread Cain, Mark
 
The attached file works on my Windows XP/IE7 machine.  It will delete
all the temporary internet files and the cookies.  I don't remember
where I got it or who wrote it originally, but I tweaked it to get it to
work right for me.

Hope this helps,

--Mark


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of reinier
Sent: Wednesday, June 13, 2007 1:35 AM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] how to properly use the snippet function?

I am trying to get rid of all cookies via a function.
On this forum I found the Snippet thingy.
http://rubyforge.org/snippet/detail.php?type=snippet&id=26
So I included that code in my script and trying to use it, but I can't
figure out how.

this is the code:
[code]
DeleteUrlCacheEntry = Win32API.new("wininet", "DeleteUrlCacheEntry",
['P'], 'V') [/code]

So what function should be called to delete all the cookies?
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


CookieKiller.rb
Description: CookieKiller.rb
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] Carl L Shaulis is out of the office.

2007-06-13 Thread carl . l . shaulis




I will be out of the office starting  06/13/2007 and will not return until
06/14/2007.

If you need immediate assistance please try Cari Spruiell or my cell  phone
at 512-560-5773.  Thanks!
--
"NOTICE:  The information contained in this electronic mail transmission is
intended by Convergys Corporation for the use of the named individual or
entity to which it is directed and may contain information that is
privileged or otherwise confidential.  If you have received this electronic
mail transmission in error, please delete it from your system without
copying or forwarding it, and notify the sender of the error by reply email
or by telephone (collect), so that the sender's address records can be
corrected."

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] $ie.text.include? problem

2007-06-13 Thread imran
Hi, *carabasu*

Please execute the code below, i have just removed form your code an extra 
*end*.
and added 

require 'watir' and replaced IE.new with Watir::IE.new because i didn't use 
include WATIR

Execute below code it will print one .. OK

require 'watir'
testSite = 'http://www.google.com'

$ie = Watir::IE.new
$ie.goto(testSite)

if $ie.text.include?("Programs") 
then puts "OK"
else puts "CRAP"
end
:)

*kind Regards*
M.Imran
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] OT-ish - What is determining the order this hash gets iterated through?

2007-06-13 Thread Paul Carvalho

Just remember that if you 'sort' a hash, you get an *array* not a hash.  You
may need to adjust your code to match.  That's tripped me up before.


On 12/06/07, Chris McMahon wrote:


> So here's the question: Why aren't the csv results in the order of the
hash?
> And what order /are/ they in? There seems to be some method to the
madness
> here, because they come out consistently in the /same/ order...but it
isn't
> the order they are listed in the hash, or alphabetical by key or
> value...anyone know how this works?

Hashes are not sorted in predictable ways, regardless of which
language you're using.  Luckily, in Ruby, the Hash object has a sort()
method:  http://www.rubycentral.com/book/ref_c_hash.html#Hash.sort

I'm not a huge expert at this stuff, but I've tripped over it before.

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Porting Watir to JRuby

2007-06-13 Thread Nick Sieger
On 6/13/07, Nivetha Padmanaban <[EMAIL PROTECTED]> wrote:
>
> Any plans of porting WATIR to JRuby??

None that I know of at the moment.  The stumbling block is to get a
compatible version of 'win32ole' on JRuby which we don't have.

/Nick
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] how to delete cookies (trying now with snippet but this is quite unclear)

2007-06-13 Thread reinier
got it working myself.
by calling the delete_cache and including the file mentioned below (got that 
from this forum somewhere)
[code]
#!/bin/ruby
#
#
#
#
#
# set TEMPIF=%USERPROFILE%\Local Settings\Temporary Internet Files
# %TEMPIF%\Content.IE5\Index.DAT


require 'Win32API'

#
#
# HashMethods = a Hash that can be accessed with methods
#   e.g.h = MethodHash.new
#   h['street'] = 'Broadway'
#   h.street= 'Broadway'
#   puts h.street  ===> Broadway

require 'delegate'

class MethodHash < SimpleDelegator
def initialize h = {}
super h
end

def method_missing(method_name, *args)
name = method_name.to_s
if name.ends_with?('=')
self[ name.chop ] = args[0]
else
self[ name ]
end
end
end


class String
def ends_with?(substr)
len = substr.length
self.reverse() [0 .. len-1].reverse == substr
end

def starts_with?(substr)
len = substr.length
self[0 .. len-1] == substr
end

alias start_with?  starts_with?
alias begin_with?  starts_with?
alias begins_with? starts_with?
alias end_with?ends_with?

# String each() operator reads line-by-line
# These functions return characters
def each_char
self.each_byte{|x| yield x.chr }
end
def collect_char
r = []
self.each_byte{|x| r << x.chr }
r
end
end


=begin

// Windows System calls needed to clear cache.
//

BOOL DeleteUrlCacheEntry(
  LPCTSTR lpszUrlName
);

HANDLE FindFirstUrlCacheEntry(
  LPCTSTR lpszUrlSearchPattern,
  LPINTERNET_CACHE_ENTRY_INFO lpFirstCacheEntryInfo,
  LPDWORD lpdwFirstCacheEntryInfoBufferSize
);

BOOL FindNextUrlCacheEntry(
  HANDLE hEnumHandle,
  LPINTERNET_CACHE_ENTRY_INFO lpNextCacheEntryInfo,
  LPWORD lpdwNextCacheEntryInfoBufferSize
);

BOOL FindCloseUrlCache(
IN HANDLE hEnumHandle
);


typedef struct _INTERNET_CACHE_ENTRY_INFO {
DWORD dwStructSize;
LPTSTR lpszSourceUrlName;
LPTSTR lpszLocalFileName;
DWORD CacheEntryType;
DWORD dwUseCount;
DWORD dwHitRate;
DWORD dwSizeLow;
DWORD dwSizeHigh;
FILETIME LastModifiedTime;
FILETIME ExpireTime;
FILETIME LastAccessTime;
FILETIME LastSyncTime;
LPBYTE lpHeaderInfo;
DWORD dwHeaderInfoSize;
LPTSTR lpszFileExtension;
union {
DWORD dwReserved;
DWORD dwExemptDelta;
}
} INTERNET_CACHE_ENTRY_INFO, *LPINTERNET_CACHE_ENTRY_INFO;


=end




def delete_cache
w = get_api('wininet',FUNCS)
i = 0

info,infosize = get_first_info(w)
cache = w.FindFirstUrlCacheEntry.Call(nil,info,infosize)
if cache != 0
begin
len, source_file_ptr, local_file_ptr = info.unpack 'LLL'
w.DeleteUrlCacheEntry.Call(source_file_ptr)
i += 1
info,infosize = get_next_info( w, cache )
end while w.FindNextUrlCacheEntry.Call(cache, info, infosize) != 0
end
w.FindCloseUrlCache.Call(cache)
i
end

def get_first_info(api)
sizenum = [0,0].pack('L*')
buf =  [1024,0].pack('L*').ljust(1024)
r = api.FindFirstUrlCacheEntry.Call(nil,nil,sizenum)
n = sizenum.unpack('L')[0]
info = sizenum.ljust(n)
[info,sizenum]
end

def get_next_info(api, handle)
sizenum = [0,0].pack('L*')
buf =  [1024,0].pack('L*').ljust(1024)
r = api.FindNextUrlCacheEntry.Call(handle,nil,sizenum)
n = sizenum.unpack('L')[0]
info = sizenum.ljust(n)
[info,sizenum]
end


#
# Win32 API used in this file is listed here.
# Each system call can be instatiated like this
#DeleteUrlCacheEntry = Win32API.new("wininet", "DeleteUrlCacheEntry", 
['P'], 'V')
# Instead, the functions are defined dynamically from this list:
#
FUNCS = {
'FindFirstUrlCacheEntry' => ['ppp','n'],
'FindNextUrlCacheEntry'  => ['npp','n'],
'DeleteUrlCacheEntry'=> ['n',  'n'],
'FindCloseUrlCache'  => ['n',  'n']
}

#
# get_api returns a hash with Win32 API system calls
# Usage:
# api = get_api('Kernel32', {'GetLastError'=>['V', 'N'],...})
#
def get_api(library, function_hash)
f = MethodHash.new
function_hash.each{|funcname,types|
in_types = types[0].collect_char{|x| x}
out_type = types[1]
f[funcname] = Win32API.new(library, funcname, in_types, out_type)
}
f
end


def getLastError
f = Win32API.new('Kernel32', 'GetLastError', ['V'], 'N')
f.call
end


if __FILE__ == $0
n = main
# print "Deleted #{n} items\n"
end


[/code]
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Porting Watir to JRuby

2007-06-13 Thread Nivetha Padmanaban
Any plans of porting WATIR to JRuby??

Regards,
Nivetha
Email - [EMAIL PROTECTED]
Mobile - (0) 98807 17518___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Best Combination of Ruby and Watir

2007-06-13 Thread Željko Filipin

On 6/8/07, Bret Pettichord <[EMAIL PROTECTED]> wrote:


However, if you are using the Watir::IE#modal_dialog method, you must
use Ruby 1.8.2-14 and not a more recent version.



I just installed ruby182-14.exe on clean xp pro machine. Components: only
RubyGems Package Manager. Then I tried to install watir-1.5.1.1192.gem. I
first executed

Y:\>gem install win32-process --include-dependencies

and got this error message.

Y:\>"c:\ruby\bin\ruby.exe" "c:\ruby\bin\gem" install win32-process
--include-dep
endencies
ERROR:  While executing gem ... (OptionParser::InvalidOption)
   invalid option: --include-dependencies

I uninstalled ruby182-14.exe and installed ruby182-15.exe and did not get
that error message. Am I doing something wrong?

Zeljko
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Want to display data in the same row using Puts

2007-06-13 Thread Željko Filipin

Hi Sapna,

If you have variable called var, you can display its value inside string
like this.

puts "var = #{var}"

Zeljko
--
ZeljkoFilipin.com
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] syntax error, unexpected tIVAR

2007-06-13 Thread Željko Filipin

On 6/12/07, Jeff Fry <[EMAIL PROTECTED]> wrote:


@ie.button(:class =>'Button Menu', :index => 2).click
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:1098:in `send':
{:class=>"Button Menu", :index=>2} is not a symbol (TypeError)



Hi Jeff,

I guess that button is one of those elements that still do not have multiple
attribute support.

Zeljko
--
ZeljkoFilipin.com
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] how to properly use the snippet function?

2007-06-13 Thread reinier
I am trying to get rid of all cookies via a function.
On this forum I found the Snippet thingy.
http://rubyforge.org/snippet/detail.php?type=snippet&id=26
So I included that code in my script and trying to use it, but I can't figure 
out how.

this is the code:
[code]
DeleteUrlCacheEntry = Win32API.new("wininet", "DeleteUrlCacheEntry", ['P'], 'V')
[/code]

So what function should be called to delete all the cookies?
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Want to display data in the same row using Puts

2007-06-13 Thread sapna
Hi,

I want display data in the same row using puts. For the reference see below. 
Thanks in advance.

puts "{a[4][1]):{a[4][2]}" --> This is not working but. Tell me how to put this 
value.

Regards
Sapna
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general