Re: [Wtr-general] How to send yes to the security certificate

2007-05-21 Thread Ian Webb
Which popup/certificate error message are you getting?

I've had a similar, possibly the same, problem. My workaround was to
turn off the warning message about a certificate name mismatch in
Internet Options  Advanced  uncheck Warn about certificate address
mismatch. (Basically, our testing site has a different hostname but the
same certificate as the live site, hence a mismatch error)

If this is the other common certificate error, non-trusted root, then
you should be able to add the certificate and prevent the popup.

Cheers,
Ian

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Koteswara
Annavarapu
Sent: Monday, May 21, 2007 5:07 AM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] How to send yes to the security certificate

Hi all,

I am working with a secured site , which when invoked asks me for
accepting the security certificate. 
Can some one let me know , how can we handle such things through Watir. 

Thanks in advance 
Koteswara Rao

___
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] Running test script once for each datarow in excel

2007-05-11 Thread Ian Webb
This is very simple with a CSV file:

require 'csv'

CSV::Reader.parse(File.open(ARGV[0], 'rb')) do |row| #open the filename
given as first command line argument
  userid = row[0] #note that the CSV module index starts at 0
  passwd = row[1]
  loginToSite(userid,passwd) #whatever your login code is
End

Cheers,
Ian

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Vipul
Sent: Friday, May 11, 2007 7:51 AM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] Running test script once for each datarow in
excel

i am testing a site which has login page.

i want to automate login with different user credentials each time.

i want username and pwd values to come from excel sheet or input.rb
whichever possible.

Does anyone has the code or suggestion for implementing this.
___
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] Using an ie.table.each do |row| loop when thepagein the ie window refreshes itself

2007-05-08 Thread Ian Webb
This worked great! I only had to make a couple of minor corrections.

First off, each_with_index starts counting at 0, while Watir starts
counting as 1. So I had to do rows_to_click  (i+1). And when iterating
back through the table to actually click the links, I had to add ie.wait
to that loop to keep it from trying to click the link as soon as the
child window closed, before IE had even had a chance to render the
reloaded page!

In any case, it's working now, and I learned quite a bit. I agree that
the each_with_index should be included - although I'm not sure what the
preferred index behaviour should be. Perhaps that's why it's not in
there now?

Thanks again,
Ian

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ethan Jewett
Sent: Tuesday, May 08, 2007 9:18 AM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Using an ie.table.each do |row| loop when
thepagein the ie window refreshes itself

Ian,

Sorry about the rows and each_with_index issues.  Hopefully
that'll teach me to test suggestions : )

table(:index,29) clearly does the same thing I thought
table(:index,29).rows does.

As for the each_with_index, if you just mixin the Enumerable module
to the Watir::Table class like this:

class Watir::Table
  include Enumerable
end

before you use each_with_index, then you should be in good shape.
This seems like something that should be added to the base Watir,
since rows in a table are generally an enumerable element and the
current Watir::Table.each method returns the rows of the table in
order.

Any objections?  If not, I'll open a ticket.

Ethan

On 5/7/07, Ian Webb [EMAIL PROTECTED] wrote:
 Thanks - this does look like a good approach. The table's layout
doesn't
 change, it just reloads to update the data within the table with the
 entries that were just made in the popup window. It's a really
annoying
 UI, especially when you have test cases that require changing a dozen
 rows and therefore opening the popup a dozen times.. hence why I'm
quite
 eager to get Watir doing it instead.

 However, each_with_index appears to be an undefined method for
ie.table
 objects. I can iterate on .each just fine, but .each_with_index is
 undefined. (.rows is undefined as well; .each works fine if I leave it
 out)

 I'm wondering if maybe there's a way to store the indices of the
buttons
 it's going to click on within the array, rather than the rows
 themselves. I tried buttons_to_click  row[5].link(:index,1), but
that
 doesn't work.

 Thanks,
 Ian

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Ethan Jewett
 Sent: Saturday, May 05, 2007 6:55 PM
 To: wtr-general@rubyforge.org
 Subject: Re: [Wtr-general] Using an ie.table.each do |row| loop when
 thepage in the ie window refreshes itself

 Ian,

 Reloading probably invalidates the table object, resulting in your
 Access denied error when ruby goes back for the next row in the
 table.

 Suggestion:  Assuming that submitting and reloading doesn't affect the
 table layout, use rows.each_with_index to build an array of indices of
 relevant rows.  Then cycle through the array clicking and submitting.
 For instance (untested, unfortunately):

 rows_to_click = Array.new

 ie.table(:index, 29).rows.each_with_index do |row, i|
   rows_to_click  i if (row[1].text =~ /#{journals}/) != nil
 end

 rows_to_click.each do |i|
   [Do the clicking and such for row i here.]
 end

 This could be made substantially prettier, but hopefully it gets the
job
 done.

 Ethan

 On 5/4/07, Ian Webb [EMAIL PROTECTED] wrote:
  Here's the code snippet that's giving me problems:
 
ie.table(:index,29).each do |row|
  if (row[1].text =~ /#{journals}/) != nil then #If there is a
match
  for that regex
row[5].link(:index,1).click # this makes the popup window
appear
cw = Watir::IE.attach(:title,'Popup Window') # attach to the
 popup
  window
doRolesPopup(cw) # fill out and submit the form
  end
end
 
  doRolesPopup fills out a form in the cw page, then clicks submit.
The
  submit button submits the form, then closes the cw window and
reloads
  the ie window. This reload of the page referenced by the ie object
  appears to break the row object, since I get the following error:
 
  c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2461:in `invoke': unknown
  property or method `rows' (WIN32OLERuntimeError)
  HRESULT error code:0x80070005
Access is denied. from
  c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2461:in `row'
  from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2404:in `each'
  from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2404:in `upto'
  from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2404:in `each'
  from assignroles.rb:51
  from c:/ruby/lib/ruby/1.8/csv.rb:532:in `parse'
  from c:/ruby/lib/ruby/1.8/csv.rb:560:in `each'
  from c:/ruby/lib/ruby/1.8/csv.rb:531:in `parse'
  from assignroles.rb:35
 
  Is there any

Re: [Wtr-general] Using an ie.table.each do |row| loop when thepage in the ie window refreshes itself

2007-05-07 Thread Ian Webb
Thanks - this does look like a good approach. The table's layout doesn't
change, it just reloads to update the data within the table with the
entries that were just made in the popup window. It's a really annoying
UI, especially when you have test cases that require changing a dozen
rows and therefore opening the popup a dozen times.. hence why I'm quite
eager to get Watir doing it instead.

However, each_with_index appears to be an undefined method for ie.table
objects. I can iterate on .each just fine, but .each_with_index is
undefined. (.rows is undefined as well; .each works fine if I leave it
out)

I'm wondering if maybe there's a way to store the indices of the buttons
it's going to click on within the array, rather than the rows
themselves. I tried buttons_to_click  row[5].link(:index,1), but that
doesn't work.

Thanks,
Ian

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ethan Jewett
Sent: Saturday, May 05, 2007 6:55 PM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Using an ie.table.each do |row| loop when
thepage in the ie window refreshes itself

Ian,

Reloading probably invalidates the table object, resulting in your
Access denied error when ruby goes back for the next row in the
table.

Suggestion:  Assuming that submitting and reloading doesn't affect the
table layout, use rows.each_with_index to build an array of indices of
relevant rows.  Then cycle through the array clicking and submitting.
For instance (untested, unfortunately):

rows_to_click = Array.new

ie.table(:index, 29).rows.each_with_index do |row, i|
  rows_to_click  i if (row[1].text =~ /#{journals}/) != nil
end

rows_to_click.each do |i|
  [Do the clicking and such for row i here.]
end

This could be made substantially prettier, but hopefully it gets the job
done.

Ethan

On 5/4/07, Ian Webb [EMAIL PROTECTED] wrote:
 Here's the code snippet that's giving me problems:

   ie.table(:index,29).each do |row|
 if (row[1].text =~ /#{journals}/) != nil then #If there is a match
 for that regex
   row[5].link(:index,1).click # this makes the popup window appear
   cw = Watir::IE.attach(:title,'Popup Window') # attach to the
popup
 window
   doRolesPopup(cw) # fill out and submit the form
 end
   end

 doRolesPopup fills out a form in the cw page, then clicks submit. The
 submit button submits the form, then closes the cw window and reloads
 the ie window. This reload of the page referenced by the ie object
 appears to break the row object, since I get the following error:

 c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2461:in `invoke': unknown
 property or method `rows' (WIN32OLERuntimeError)
 HRESULT error code:0x80070005
   Access is denied. from
 c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2461:in `row'
 from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2404:in `each'
 from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2404:in `upto'
 from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2404:in `each'
 from assignroles.rb:51
 from c:/ruby/lib/ruby/1.8/csv.rb:532:in `parse'
 from c:/ruby/lib/ruby/1.8/csv.rb:560:in `each'
 from c:/ruby/lib/ruby/1.8/csv.rb:531:in `parse'
 from assignroles.rb:35

 Is there any way to keep this simple .each loop, or do I need to work
 around it?

 Thanks,
 Ian
 ___
 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] Using an ie.table.each do |row| loop when thepagein the ie window refreshes itself

2007-05-07 Thread Ian Webb
Here's the HTML. This row repeats with different values. The field with Name 
Goes Here in it is the field we're filtering on - if this field is matched by 
a given regex, then make a note that we need to click the button in the last 
column of this row.

tr 

td class='dataentry'p class='pagecontents'Name Goes Here/p/td

td class='dataentry'p class='pagecontents'Active Member/p/td

td class='dataentry'p class='pagecontents'AU, REV/p/td

td class='dataentry'p 
class='pagecontents'nbsp;Supportnbsp;/p/td

TD CLASS='dataentry' WIDTH=1% ALIGN=CENTERP CLASS='pagecontents'a 
href= javascript: 
popWindow('s?NEXT_PAGE=ALTER_PERMISSIONS_POPUPPERSON_ID=0PAGE_NAME=SUPPORT_ADD_USER3AORGANIZATION_ID=EDIT_PERSON_FL=YCURRENT_ROLE_ID=0CURRENT_USER_ID=0DOCUMENT_HASHCODE=SANITY_CHECK_DOCUMENT_ID=CONFIG_ID=1','edit_permission_pop',
 550, 600); img src='/images/icons/edit.gif' border=0/a/TD 

  /tr

 

The PERSON_ID field in this request is constant for each user/time the table is 
displayed, but is not constant between instances. The ORGANIZATION_ID field 
changes for each row of the table, and *is* the same between instances.

 

I would rather not parse out the HTML and then manually construct these 
requests - this should as much as possible be based on what the user sees, not 
the underlying HTML. However, if I have to that's a possibility.

 

Thanks,

Ian

 



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ċ½eljko Filipin
Sent: Monday, May 07, 2007 9:04 AM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Using an ie.table.each do |row| loop when thepagein 
the ie window refreshes itself

 

On 5/7/07, Ian Webb [EMAIL PROTECTED] wrote:

I'm wondering if maybe there's a way to store the indices of the buttons
it's going to click on within the array, rather than the rows
themselves. I tried buttons_to_click  row[5].link(:index,1), but that 
doesn't work.


Hi Ian,

I am not sure I understood what you want to do here (I need to see html), but 
try changing

buttons_to_click  row[5].link(:index,1) 

to 

buttons_to_click  ie.row[5].link(:index,1)

Zeljko
-- 
ZeljkoFilipin.com 

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

[Wtr-general] Using an ie.table.each do |row| loop when the page in the ie window refreshes itself

2007-05-04 Thread Ian Webb
Here's the code snippet that's giving me problems:

  ie.table(:index,29).each do |row|
if (row[1].text =~ /#{journals}/) != nil then #If there is a match
for that regex
  row[5].link(:index,1).click # this makes the popup window appear
  cw = Watir::IE.attach(:title,'Popup Window') # attach to the popup
window
  doRolesPopup(cw) # fill out and submit the form
end 
  end

doRolesPopup fills out a form in the cw page, then clicks submit. The
submit button submits the form, then closes the cw window and reloads
the ie window. This reload of the page referenced by the ie object
appears to break the row object, since I get the following error:

c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2461:in `invoke': unknown
property or method `rows' (WIN32OLERuntimeError)
HRESULT error code:0x80070005
  Access is denied. from
c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2461:in `row'
from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2404:in `each'
from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2404:in `upto'
from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2404:in `each'
from assignroles.rb:51
from c:/ruby/lib/ruby/1.8/csv.rb:532:in `parse'
from c:/ruby/lib/ruby/1.8/csv.rb:560:in `each'
from c:/ruby/lib/ruby/1.8/csv.rb:531:in `parse'
from assignroles.rb:35

Is there any way to keep this simple .each loop, or do I need to work
around it?

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