[Wtr-general] How to differentiate between a 'clicked' a 'disabled' or 'greyed-out' tab

2007-06-28 Thread vijay
Hello people,

As part of testing with Watir, I want to check whether a particular tab (in a 
table) is in a 'clicked' (one that is currently clicked) state or in a 
'disabled' (greyed-out or inaccessible ) state.  I am not able to distinguish 
between a that is clicked and a tab that is disabled using the existence 
(.exists?) or the enabled/disabled (.enabled?/.disabled?) functions, the only 
two functions that I could think of for finding a solution.  

To be more precise, 

$ie.frame('Detail').cell(:text,'Instructions').exists? 
$ie.frame('Detail').cell(:text,'Instructions').enabled?

returns 'true' and 'false' for the 'Instructions' tab that is in a 'clicked 
state'

$ie.frame('Detail').cell(:text,'Step 2.Inventors').exists? 
$ie.frame('Detail').cell(:text,'Step 2.Inventors').enabled?

returns 'true' and 'false' for the 'Step 2.Inventors' tab that is in a 
'disabled state'

Since both these answers are same, how to differentiate a 'clicked' tab from a 
'disabled' tab through Watir?

Thanks for your time,
Vijay.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] How to differentiate between a 'clicked' a 'disabled' or 'greyed-out' tab

2007-06-28 Thread Željko Filipin

Hi Vijay,

It would help if you posted html of that tab.

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

[Wtr-general] data driven tests and looping through rows

2007-06-28 Thread Jason Naylor
What's your preferred method and code for looping through source files?

Essentially, each row within my source file represents a bunch of
variables I want to use - whether they be various usernames/passwords
for login; information on various fields on my screen I want to
assert; etc.

I've used the following (once) previously with success, but I don't
feel it's the optimal code.  Surely there's an easier, simpler way
within Ruby?  Problem is I'm just trying to learn.

userpass_file = IO.readlines('xxx_INPUT_FILE_xxx')
  i = 1 #start on second line (line 1), the first line (line 0) is
column headings
while i  userpass_file.length do
  array = CSV.parse_line(userpass_file[i])
  varable1 = array[0]
  variable2 = array[1]
  variable3 = array[2]
DO YOUR STUFF WITH THE VARIABLES
  i = i +1 #increment for the next line
end

Maybe the CSV parser will do a better job???  (My source file is
currently a CSV if that helps.)

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


Re: [Wtr-general] Unable to locate object using ie.#{variable}

2007-06-28 Thread Jason
Should this be possible?

i.e. rather than specify an *exact* object within the IE, have this 'object' 
within a variable:

code
  v_type = text_field
  ie.#{v_type}(:id, emailAddress).flash
/code

It doesn't work as I have it above.  Neither do the following:

code
  ie.{v_type}(:id, emailAddress).flash
  ie.#v_type(:id, emailAddress).flash
  ie.v_type(:id, emailAddress).flash
/code

Can I actually do this???
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Unable to locate object using ie.#{variable}

2007-06-28 Thread Željko Filipin

On 6/28/07, Jason [EMAIL PROTECTED] wrote:


Can I actually do this???


Hi Jasnon,

I think you can not do that. What do you want to do with that? Maybe there
is another way.

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

[Wtr-general] assert on the color of a row in the table

2007-06-28 Thread Ajitesh Srinetra

Hi All
Just wanted to know how can we assert on the Color of a row of a table.
The color is there in the CSS.

The html snippet is like this
/tr
tr style=color: rgb(192, 39, 77);
td align=right style=padding: 5px; 5 /td
td align=center style=padding: 5px; 27-06-2007 /td
td align=right style=padding: 5px; 400.00 /td
td align=right style=padding: 5px; 400 /td
td align=right style=padding: 5px; 40 /td
/tr

I tried ie.table (:id,'tbl_show_records')[5][1].style but i am getting
#WIN32OLE:0x2dad28c as the returned value.

Thanks in advance
Ajitesh Srinetra
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Unable to locate object using ie.#{variable}

2007-06-28 Thread Jason
  v_type = text_field
  ie.#{v_type}(:id, emailAddress).flash
 I think you can not do that. What do you want to do with that? Maybe there
 is another way.
I simply wanted to loop through a list of objects (text_fields, select boxes, 
radio buttons, checkboxes, etc) on a page, ensuring each exists and maybe a 
little more verification for each (value, colour, maxlength, etc...).

However, I'm attempting to drive a lot of my tests via data-sets, i.e. .CSV 
files, rather than hardcoding too many field details into the script itself.

Suggestions?

It's actually not a big deal, I'll just script each field I think.  Just 
attempted the above, hoping it might be possible.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] data driven tests and looping through rows

2007-06-28 Thread marekj

Jason,
I think you can do better with Faster CSV gem.
You can read (slurp) the entire csv into array of arrays (two dimensional).
like zo...

require 'fastercsv'
mydata = FCSV.read('filename.csv')

now you can do whatever you need with mydata because it's a 2D Array[][]
http://fastercsv.rubyforge.org/

another solutions is persist data in yaml file and read it with YAML builtin
lib.
http://yaml4r.sourceforge.net/cookbook/





On 6/28/07, Jason Naylor [EMAIL PROTECTED] wrote:


What's your preferred method and code for looping through source files?

Essentially, each row within my source file represents a bunch of
variables I want to use - whether they be various usernames/passwords
for login; information on various fields on my screen I want to
assert; etc.

I've used the following (once) previously with success, but I don't
feel it's the optimal code.  Surely there's an easier, simpler way
within Ruby?  Problem is I'm just trying to learn.

userpass_file = IO.readlines('xxx_INPUT_FILE_xxx')
  i = 1 #start on second line (line 1), the first line (line 0) is
column headings
while i  userpass_file.length do
  array = CSV.parse_line(userpass_file[i])
  varable1 = array[0]
  variable2 = array[1]
  variable3 = array[2]
DO YOUR STUFF WITH THE VARIABLES
  i = i +1 #increment for the next line
end

Maybe the CSV parser will do a better job???  (My source file is
currently a CSV if that helps.)

- Jason
___
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] UnknownObject Exception when running test cases

2007-06-28 Thread Tiffany Fodor
Thanks for the suggestion!

I tried it and I'm pointing to the correct link, so I still don't know what my 
problem with this is.  Looking up objects using IRB did help me with a 
different issue I was working through, however!
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] CAN BE CLICK LINK ASSOCIATED WITH AN IMAGE

2007-06-28 Thread Jason
 ie.link(:after?, ie.image(:id, 'foo')).click

Does / can this apply to anything other than 'links' or 'images'?  i.e. I 
attempted this:

   ie.text_field(:after?, ie.label(:for, confirmPassword)).flash

Which didn't work.  Even though the individual ie.label(:for, 
confirmPassword) *does* work.

Asking too much here?  :)
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Ruby/Watir on Vista : watir-1.5.1.1192 and windows-pr-0.6.2 : SetConsoleCommandHistoryMode : RuntimeError

2007-06-28 Thread Michael Kernaghan
Problem occurs with watir-1.5.1.1192 but DOES NOT occur with
watir-1.5.1.1166

 

Good result thanks!

 

 I get these errors:

 


c:/ruby/lib/ruby/gems/1.8/gems/windows-pr-0.6.2/lib/windows/console.rb:7
6:in 

 `initialize': GetProcAddress: SetConsoleCommandHistoryMode or 

 SetConsoleCommandHistoryModeA (RuntimeError

 

 

Your error is with windows-pr 0.6.2 and the documentation is from 0.6.6.

In any case the problem is with the gem. I have both versions installed 
on my vista laptop. Can you track down the problem to a specific version

of this gem?
 
Bret

 

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

Re: [Wtr-general] CAN BE CLICK LINK ASSOCIATED WITH AN IMAGE

2007-06-28 Thread Charley Baker

What's :for? It's not part of Watir. Have you tried by :name and/or :id?

On 6/28/07, Jason [EMAIL PROTECTED] wrote:


 ie.link(:after?, ie.image(:id, 'foo')).click

Does / can this apply to anything other than 'links' or 'images'?  i.e. I
attempted this:

   ie.text_field(:after?, ie.label(:for, confirmPassword)).flash

Which didn't work.  Even though the individual ie.label(:for,
confirmPassword) *does* work.

Asking too much here?  :)
___
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] UnknownObject Exception when running test cases

2007-06-28 Thread Paul Carvalho

If the code below is an actual snippet from your code then could the *order*
the tests be the problem?

Please remember that the _default_ order of execution is ascending alpha, so
the script would likely try to run the tests in the following order
regardless of how they are arranged in the script :
1. test_addAccounts
2. test_login

If the script hasn't logged in *before* you try to add the account, then you
will always get an error.

There are different ways of working around this issue.  You could try
changing the test method names or insert a command to override the order of
test execution.  Check the message archives for details - I didn't find
anything in the FAQ right now for it.

Let us know if that helps.  Cheers.  Paul C.


On 25/06/07, Tiffany Fodor [EMAIL PROTECTED] wrote:


Hi!

I'm creating a test harness that will first collect all of the data
necessary to run the test cases then then execute the test cases.

Here's the code that is calling the test cases:

class TestScript  Test::Unit::TestCase

def test_login
login($producerName, $producerPass)
end

def test_addAccounts
addAccounts($testAccounts)
end
end

The login test works just fine, but the addAccounts test returns the
following:

Watir::Exception::UnknownObjectException: Unable to locate object, using
text and Find Account

This happens no matter what link or field I try to touch.  The same
commands work in the login test.  I've tried using the attach method to
specify what window to use, but that hasn't helped either.


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

Re: [Wtr-general] UnknownObject Exception when running test cases

2007-06-28 Thread Tiffany Fodor
Paul,

Thank you, thank you, thank you

I had moved on, assuming there was something weird about the way the login was 
working.

This morning, I added a new test case that wasn't in alphabetical order and 
I've been beating my head against my desk trying to figure out why debug 
statements from my third test were showing up before my second test started.  
Now that I've appended a number to the test names to indicate the correct 
order, they work just fine.  Yippee!!!

Thanks again for your help!

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


[Wtr-general] Best Combination - for Modal Dialog/Vista

2007-06-28 Thread Michael Kernaghan
I have been working on getting modal dialog tests to work running from
Vista.

 

As of now, the current working combination is Ruby 1.8.2 -15 and Watir
Gem 1.5.1.1166 and I have made no special changes to either of those.

I am looking for a good test example somewhere. I have got a simple one
to work so far. The modal dialogs I actually have to test for real are
more complex, and in fact involve stacked frames in modal dialogs. 

Here is the script I run as a simple test:

require 'test/unit'
require 'watir'

class ModalDialog  Test::Unit::TestCase
def test_simple_modal_dialog
ie = Watir::IE.start http://www.webreference.com/js/tips/010814.html; 
ie.button(:value, 'Push To Create').click_no_wait
ie.modal_dialog.text_field(:name, 'IC_QueryText').set('Modal Dialog')
ie.modal_dialog.button(:name, 'SUBMIT').click

puts 'Check that search results are found:' 
assert(ie.text.include?(Modal Dialog))
end
end

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

Re: [Wtr-general] Unable to locate object using ie.#{variable}

2007-06-28 Thread hhwwpssp
Hi Jason,

Try:

v_type = 'text_field'
instance_eval(ie.#{v_type}(:id, 'emailAddress').flash)

Or:

v_type = 'text_field'
ie.send(v_type.to_sym, :id, 'emailAddress').flash
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] UnknownObject Exception when running test cases

2007-06-28 Thread hhwwpssp
 Now that I've appended a number to the test names to indicate the correct 
 order, they work just fine.

Maintaining the numbers to keep correct order can become a pain as
your test suite grows.  You can also make the tests run in the order
you defined them by subclassing Watir::TestCase instead of
Test::Unit::TestCase.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] how to install Eclipse plugin for ruby ?

2007-06-28 Thread jieke
I try to use Eclipse debug ruby program. So I download a plugin named RDT(Ruby 
Development Tools).But I can't use it.(The RDT download 
http://rubyeclipse.sourceforge.net/;)
I  startup Eclipse and click help/software Updates/find and install/finish
IT register Network connection problems encountered during search.
IT is failed.How can do it?
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Problem in clicking javascript alert button in firewatir

2007-06-28 Thread VIKASH KUMAR
I am using firewatir version 1.0.2
I am able click on javascript OK button using the below code ::
$ff.button(:text,/Cancel/).click_no_wait
$ff.click_jspopup_button(OK)

But, I have a scenario in which javascript alert comes (and sometimes may not) 
when we change an item in select list.
e.g.
$ff.select_list(:name,max).select(250)
#Javascript alert comes, if we select 100, alert doesn't comes.

Please help me out in achieving this.
Thanks in advance
Vikash

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download 
Now! http://messenger.yahoo.com/download.php___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Problem in clicking javascript alert button in firewatir

2007-06-28 Thread Angrez Singh

Hi,

We are working on it and probably this will be there in next release.

Regards,
Angrez

On 6/29/07, VIKASH KUMAR [EMAIL PROTECTED] wrote:


I am using firewatir version 1.0.2
I am able click on javascript OK button using the below code ::
$ff.button(:text,/Cancel/).click_no_wait
$ff.click_jspopup_button(OK)

But, I have a scenario in which javascript alert comes (and sometimes may
not) when we change an item in select list.
e.g.
$ff.select_list(:name,max).select(250)
#Javascript alert comes, if we select 100, alert doesn't comes.

Please help me out in achieving this.
Thanks in advance
Vikash

Send free SMS to your Friends on Mobile from your Yahoo! Messenger.
Download Now! http://messenger.yahoo.com/download.php

___
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