[Wtr-general] Multiple threads and the find file dialog box - failure to select the file

2007-07-18 Thread Jason
I've got some simple thread code, included below, which will attempt to process 
every file it finds in a particular directory in a new thread within my 
application under test.  This is essentially some very light load testing.

(Obviously I've left a lot of the code out, but there's enough to get the idea 
below.)

Unfortunately, this only appears to function for 1, or if I'm lucky, 2, files.  
Essentially the first thread will set the file_field, but each subsequent 
thread (if attempting to input the file_field at roughly the same time) will 
fail to input the 'inputfile'.  It opens the standard Windows find file dialog, 
but won't select the file.

It simply hangs, as though it doesn't know which one to select (even though the 
inputfile variable is still valid at this stage), or fails to select it.

 def asset_transform(inputfile)
 # lots of other stuff regarding browsing the aut included in here
  ie.file_field(:id,'item_file').set(inputfile)
 end

 source_dir=File.dirname(__FILE__) + '/files_to_upload/'
 threads = []
 (Dir[source_dir+*.*]).each do |each_file|
   each_file.gsub!('/','\\')
 threads  Thread.new {asset_transform(each_file)}
 end
 threads.each {|x| x.join}

What could be behind this?  Is it a problem with threads and the find file 
dialog box?  Are threads not the best way to approach something like this?  Do 
I need to be smarter with my threads, in a way I don't know?  Is there a better 
method for the 'load' testing I'm attempting?

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


Re: [Wtr-general] How to click a row from table in webpage

2007-07-12 Thread Jason
 Please tell me how to click a column of a row of a web page.

What exactly do you want to click?

If it's the specific hyperlink you've provided, you can do a couple of things:

ie.link(:url, /snapshot=2treeobject=12507object=12507/).click
ie.link(:text, New applicationTEST2).click

... etc, etc...

As always, check out the user guide at 
http://wiki.openqa.org/display/WTR/User+Guide, and this page is very useful: 
http://wiki.openqa.org/display/WTR/Methods+supported+by+Element.

Or do you want to click +whatever+ link might exist within a particular row / 
column / cell in that table???
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Concurrent Threads and different variables in each thread

2007-07-11 Thread Jason
What would you suggest for running mutiple threads, BUT each thread using 
different variables.  I've 'stolen' the following code from Brett (thanks!) 
which does exactly as expected, BUT how would I, for instance, search for a 
different value (instead of 'pickaxe') in each thread?

 require 'thread'
 require 'watir'
 
 def test_google
ie = Watir::IE.start('http://www.google.com')
ie.text_field(:name, q).set('pickaxe')
ie.button(:value, Google Search).click
ie.html
ie.close
 end
 
 threads = []
 3.times do
threads  Thread.new {test_google}
 end
 threads.each {|x| x.join}

Could I pass some arguments to +Thread.new(args)+, or should I simply create 3 
threads as such:

  a = Thread.new { yada yada }
  b = Thread.new { yada yada }
  c = Thread.new { yada yada }

I also don't quite understand why the *threads.each {|x| x.join}* command 
exists ?
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Concurrent Threads and different variables in each thread

2007-07-11 Thread Jason
Ahhh... maybe, just MAYBE, I should try something before I give up and post.

This appeared to work:

 require 'thread'
 require 'watir'
 
 @var1='pickaxe'
 @var2='axepick'
 @var3='pckexai'
 
 def test_google(varvar)
  ie = Watir::IE.start('http://www.google.com')
  ie.text_field(:name, q).set(varvar)
  ie.button(:value, Google Search).click
  ie.html
  ie.close
 end
 
 a=Thread.new {test_google(@var1)}
 b=Thread.new {test_google(@var2)}
 c=Thread.new {test_google(@var3)}
 a.join
 b.join
 c.join

It's not pretty, and if I wanted 5 or 20 threads it would mean writing these 
lines of code 10 or 40 times.  Must be a cleaner way?
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Concurrent Threads and different variables

2007-07-11 Thread Jason
 Yes - an array - you'll figure it out ;-)

Nice.  Appreciate your confidence.

Appears to do the trick:

 threads = []
 @varvar.each do |searchterm|
   threads  Thread.new {test_google(searchterm)}
 end
 threads.each {|x| x.join}
___
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-07-02 Thread Jason
  ie.text_field(:after?, ie.label(:for, confirmPassword)).flash
 What's :for? It's not part of Watir. Have you tried by :name and/or :id? 

Fair point.  

I originally tried it from this page: 
http://wiki.openqa.org/display/WTR/Methods+supported+by+Element where it states:

 label  label tags (including for attribute)

Simply because it was the only available attribute for this field.  No ID, no 
NAME, no CLASS.  Nothing.

And it appeared to work, on it's own:

   ie.label(:for, confirmPassword).flash

certainly finds the label with this attribute.
___
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 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] 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


Re: [Wtr-general] Select the first item in a list

2007-06-22 Thread Jason Darling

Try $ie.select_list(:name, list2).select(1)

On 6/22/07, Tiffany Fodor [EMAIL PROTECTED] wrote:


Hi all!

I have a group of three tiered select lists - the first one defines what
values will appear in the second and then the value selected in the second
defines what values will appear in the third.  For my testing, I don't
really care what value is selected in the second and third lists, I just
want to select the first entry.

I've tried $ie.select_list(:name, list2).select(:index, 1), but I get
a wrong number of arguments error.

I've also tried adding the contents of the list to an array and setting
the value using the array, but the array values are nil.

intermediateValues = [$ie.select_list(:name, list2).getAllContents]
puts intermediateValues[1]
$ie.select_list(:name, list2).select(intermediateValues[1])

Any help would be greatly appreciated!

Thanks!

-Tiffany
___
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] Select the first item in a list

2007-06-22 Thread Jason Darling

We use select in our tests.  It's a method in the Watir::SelectList class.
As usual, there is more than one way to solve the task.

Cheers,
Jason

On 6/22/07, Adam Reed [EMAIL PROTECTED] wrote:


Tiffany,

I don't believe 'select' is a valid action on a select list
(ironically enough).  In my tests, I use:

$ie.select_list(:name,
list2).value=the_name_of_the_entry_here

Thanks,
Adam

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tiffany Fodor
Sent: Friday, June 22, 2007 12:27 PM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] Select the first item in a list

Hi all!

I have a group of three tiered select lists - the first one defines what
values will appear in the second and then the value selected in the
second defines what values will appear in the third.  For my testing, I
don't really care what value is selected in the second and third lists,
I just want to select the first entry.

I've tried $ie.select_list(:name, list2).select(:index, 1), but I
get a wrong number of arguments error.

I've also tried adding the contents of the list to an array and setting
the value using the array, but the array values are nil.

intermediateValues = [$ie.select_list(:name, list2).getAllContents]
puts intermediateValues[1] $ie.select_list(:name,
list2).select(intermediateValues[1])

Any help would be greatly appreciated!

Thanks!

-Tiffany
___
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] Select the first item in a list

2007-06-22 Thread Jason Darling

I would double-check the name of the value.  If that is correct, try 1)
using a regex, 2) try accessing it in IRB, or 3) use an exists? or
selected?, in no particular order.

Similar to Adam, I access mine as ie.select_list(:id, 'list2').select('name
of value').  Hope that helps.

Cheers,
Jason

On 6/22/07, Tiffany Fodor [EMAIL PROTECTED] wrote:


Thanks so much for the quick reply and suggestion!

Unfortunately, it didn't work - no error was generated from the command,
but it didn't select a value in the list either.  I could see the field
highlighted in yellow as watir 'touched' it, but no value was selected.

-Tiffany
___
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] WYSIWYG editor inside iframe - entire new

2007-06-20 Thread Jason
... problem is, I don't seem to have a div tag anywhere in sight.  All I've 
got inside the iframe is another html instance, and inside the body of 
that, nothing but a br tag.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] WYSIWYG editor inside iframe - entire new html tag I can't access

2007-06-19 Thread Jason
I've got a WYSIWYG editor inside an iframe... the editor is actually TinyMCE, 
as offered here: http://tinymce.moxiecode.com/.

I'm having trouble accessing this in Watir.  Whilst I can access the iframe, 
I can't find anything else inside the frame that resembles a field to 'use'.

Here's the HTML:

irb(main):015:0* ie.frame(:id, mce_editor_0).html

= 
HTML xmlns=\http://www.w3.org/1999/xhtml\;
HEAD
TITLEblank_page
/TITLE\r\n
META http-equiv=Content-Type content=text/html; charset=UTF-8\\r\n
META content=\MSHTML 6.00.2900.3086\ name=GENERATOR
LINK href={blah blah}.css\ rel=stylesheet
LINK href=\{blah blah}.css\ rel=stylesheet
LINK href=\{blah blah}.css\ rel=stylesheet
BASE href=https://oscar-test.scee.net/content/editorial/edit/
/HEAD\r\n
BODY class=mceContentBody dir=ltr editorId=\mce_editor_0\nbsp;
/BODY
/HTML



When I view the item in Firebug, I'm presented with something +slightly+ 
different, but ultimately I think it's the same.  Still can't see anything 
useful in here:


iframe width=872 height=239 frameborder=0 id=mce_editor_0 
name=mce_editor_0 class=mceEditorIframe border=0 marginwidth=0 
marginheight=0 leftmargin=0 topmargin=0 allowtransparency=true 
style=width: 872px; height: 239px;

html
head xmlns=http://www.w3.org/1999/xhtml;
base href={blah blah}/
titleblank_page
/title
meta content=text/html; charset=UTF-8 http-equiv=Content-Type/
link rel=stylesheet href={blah blah}.css/
link rel=stylesheet href=/javascript/tiny_mce/editor.css/
link rel=stylesheet href={blah blah}.css/
/head
body class=mceContentBody dir=ltr spellcheck=false
br _moz_editor_bogus_node=TRUE _moz_dirty=/
/body
/html

/iframe


Any thoughts???

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


Re: [Wtr-general] Load error

2007-06-15 Thread Jason Darling

can you post your test script? it would help to diagnose your problem.

Cheers,
Jason

On 6/15/07, Max Russell [EMAIL PROTECTED] wrote:


 Hi there, I'm getting the following.



`require': no such file to load -- watir (LoadError)



I've checked the FAQs and downloaded the latest 1.5 version for my Ruby
version 1.8.6.

I've listed my local gems and I can see that water is installed, yet
whenever I try and run my script, I still get the error?





*Max Russell*
Test Analyst
INPS**

___
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] forum do not get the postings made using themailing list

2007-06-07 Thread Jason Darling
Bret, +2.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Chris McMahon
Sent: Thursday, June 07, 2007 12:19 PM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] forum do not get the postings made using
themailing list


 Because of the increased traffic on this list and the ongoing troubles
 we have had keeping the forums and mailing list synchronized, I have
 been considering migrating watir-general to google groups. I would like
 to hear comments on this idea, as well as other suggestions.

+1
Now that I'm subscribed to selenium and selenium-rc groups also, I'm
really missing the yahoo/google config options that openqa doesn't
have.
___
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] How to identify the nth instance of a div?

2007-05-02 Thread Jason Aneta
Hey all,

Using the 1.5.1.1158 gem and enjoying the class support.

Within my web page, I have the following, with 3 div nested inside
the main content div.

div class=content
   div class=contentItem
   /div
   div class=contentItem
   /div
   div class=contentItem
   /div
/div

How do I retrieve / act within the nth instance, i.e. the 1st, 2nd or
3rd of these contentItem divs?


Cheers,

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


Re: [Wtr-general] How to identify the nth instance of a div?

2007-05-02 Thread Jason
 You can also identify elements using multiple attributes, for example :class 
 and :index :brbrie.div(:class =gt; #39;contentItem#39;, :index =gt; 
 3)nbsp; # access the 3rd div with a class of #39
 

Perfect - that's exactly what I was after.  Must have missed that in my 
tutorials and readings.  Lovely.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Watir T-shirt

2007-04-23 Thread Jason
I ran this by Bret and he suggested posting it on the Wtr-General to get some 
feedback from others.  So please let me know what you think.  

I would like to have a Watir t-shirt to spread the word about Watir.  We can 
put these up on the website for people to purchase them.  Here is what I 
envision- You will have a choice of either a black or white t-shirt (both 
short-sleeve and long-sleeve).  On the front we can have the Watir logo on the 
left breast area, and on the back a block of code.  I created this class below 
as a possible example.  

require Watir

class TC_future_of_automated_test_testing

def test_Watir_is_the_test_tool_of_the_future
 ie.goto(@start_page)
 assert_equal('Watir- The Future of Automated Testing', ie.title)
end

def setup
 @start_page= 'http://wtr.rubyforge.com'
end

end

Please remember that this is a t-shirt and aimed and increasing Watir 
usage/awareness to others.  Let me know what you think and if you'd be 
interested in one.

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


[Wtr-general] How to get the return code during script running?

2007-04-09 Thread Jason He
Dear all,

I write every single script for each test case and start running them by a 
batch file, I expect to capture the screen if those cases who get 
failure/error. The problem I meet now is, how to find out immediately when a 
failure/error is happen during testing. Does watir/ruby provide return code or 
message which could be used as indication to capture screen?

Regards,

Jason

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

Re: [Wtr-general] About the execution speed of waitr/ruby

2007-04-06 Thread Jason He
Hi, Zeljko,

 

 Follow your suggestion, I find the methods set_fast_speed  
set_slow_speed, and can control the script execution speed. 

I want to make it could be configurable in testing script, so write the 
following code in my test script,



$FAST_SPEED = false

class Watir::IE

 @@attach_timeout = 5

 DEFAULT_TYPING_SPEED = 0.2

 DEFAULT_SLEEP_TIME = 0.2

end



 

And the above code could take effect, but there will be two warnings output in 
console, 

../include/RESILIENCE_CLASS.rb:36: warning: already initialized constant 
DEFAULT_TYPING_SPEED

../include/RESILIENCE_CLASS.rb:37: warning: already initialized constant 
DEFAULT_SLEEP_TIME

 

It says I change the assign a new value to initialized constant. 

 

If I want to make those two values could configurable in testing script as well 
as make them conform to the watir/ruby syntax, is there a reasonable way to 
eliminate this message?

 

Thanks in advance.

 

Jason

 



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ?eljko Filipin
Sent: 2007年4月4日 16:49
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] About the execution speed of waitr/ruby

 

Hi Jason,

Try

ie.set_slow_speed
ie.set_fast_speed

If you want more control (faster, slower) you can modify that methods.

Zeljko
-- 
ZeljkoFilipin.com 

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

[Wtr-general] IDEs for Watir

2007-03-29 Thread Jason
I'd like to get people's opinion/thoughts on what is the best IDE for Watir.  
What do you use for writing you Watir tests?  I've looked a t a few, but none 
of them stand out as a clear winner.  It doesn't have to be open-source, if a 
commercial tool is a good and viable solution.

Some history:  I am currently using Eclipse, but am looking for another 
solution as the workspace component in Eclipse is proving not to work for our 
project. We use Cruise for our CI and using Eclipse requires me to write code 
for Eclipse's workspace on top of our MS Solution.  Discussing this with my 
developers, we've collectively decided that it introduces a smell to our 
project.  (Unless there is a way to abolish the notion of workspace?)  Also, 
we've looked at Steel and it shows promise, but the current version is not 
fully baked.

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


Re: [Wtr-general] About the timeout of waitr

2007-03-28 Thread Jason He
Thanks for your reply.

This is one case that opening a url, how about other operations such as click a 
button/link/image/, fill in text field, etc. If all these operations in scripts 
use this method, then the code will become not concise.
Is there a global method/variable that could simplify this problem?

Regards,
Jason

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of sathees
Sent: 2007年3月28日 13:18
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] About the timeout of waitr

That will through a timeout exception and script will terminate.
If you wish to continue, then you got to handle that.

begin
timeout(20) do |timeout_length|
ie.goto where ever you want
end
rescue
puts $!
end

this is just the basic, modify as you need.
___
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] How to get report message after running every test case

2007-03-27 Thread Jason He
Dear all,

 

I write some the filename of test cases in a windows bat file, execute
the bat file, and then report messages for each test case will output in
the console.

Now, in order to make statistics for these messages, could they also
output to the log file by script? 

 

 

The following is the report message after running one test case




Finished in 15.063 seconds.

 

  1) Failure:

test_b(TC_rt_r_login) [C:/watir1145/runtime/rt_r_login.rb:34]:

false is not true.

 

5 tests, 4 assertions, 1 failures, 0 errors




 

Regards,

Jason

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

Re: [Wtr-general] How to get report message after running everytest case

2007-03-27 Thread Jason He
Thanks for your reply.

 

But there will no message output in the console.

Could it output to both console and file?

 

Regards,

Jason



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charley Baker
Sent: 2007年3月27日 22:50
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] How to get report message after running everytest 
case

 

You can redirect the output of your bat file to a file: 
mybat.bat  results.txt 

-Charley

On 3/27/07, Jason He  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]  wrote:

Dear all,

 

I write some the filename of test cases in a windows bat file, execute the bat 
file, and then report messages for each test case will output in the console.

Now, in order to make statistics for these messages, could they also output to 
the log file by script? 

 

 

The following is the report message after running one test case



Finished in 15.063 seconds.

 

  1) Failure:

test_b(TC_rt_r_login) [C:/watir1145/runtime/rt_r_login.rb:34]:

false is not true.

 

5 tests, 4 assertions, 1 failures, 0 errors



 

Regards,

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

[Wtr-general] About the timeout of waitr

2007-03-27 Thread Jason He
Dear all,

 

What will watir do if the http server (device under test) has no
response during testing? 

 

I find it will wait for timeout and then continue to execute the script
with error message.  But, what is the value of timeout, and could that
timeout event be caught in the script?

 

Regards,

Jason

 

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

[Wtr-general] How to send the attachment by mail in Watir/Ruby

2007-03-19 Thread Jason He
Dear all,

 

After running test cases, the test result will generate as files in hard
disk, I want to send them as attachment by email, is there any way to do
it?

 

Thanks,

 

Jason

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

[Wtr-general] How to output brief/detail information when do logging

2007-03-16 Thread Jason He
Dear all,

 

I use C:\watir1145\examples\logging\example_logger1.rb to do logging, it
will output the same message both into the console and log file. 

Now, I want it output brief message on the console while detail message
in the log file, in other words, the run result for each test case on
the console and trace/debug information for every step in the log file,
is there an switch parameter in it can achieve it?

 

Or is there any ruby class/script/project which can conveniently solve
this problem?

 

Regards,

Jason

 



example_logger1.rb
Description: example_logger1.rb


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

[Wtr-general] Is there a global variable to control the scripts execution speed

2007-03-11 Thread Jason He
Dear all,
 
 
Does watir/ruby provide a global configuration variable which could used to 
change the speed of execution, rather than add many sleep in each scripts.
 
 
Regards,
Jason
 

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

Re: [Wtr-general] How to make sure that script run in line squencerather than alphabetical sequence when using load

2007-03-08 Thread Jason He
Yes, give the class name with suffix “Sequence” can make sure the code 
executing sequence according to line number in the script.

However, it seems that code in the other script won’t execute when “load” 
method is embraced in the class/function block.  

 

 

---

require 'watir/testcase'

 

class TC2_Sequential  Watir::TestCase

  def test_b; 

load 'rt/rt_r_login.rb';

print 'E'; 

end

  def test_a; 

load 'rt/rt_w_login.rb'

print 'F'; 

end

  def test_d; 

load 'rt/rt_r_system_admin_nameserver.rb' 

print 'G';

 end

 def test_c; 

load 'rt/rt_w_system_admin_nameserver.rb'

print 'H'; 

end

end

---

 

 

The output as follow,

---

C:\watir1145test.rb

Loaded suite C:/watir1145/test

Started

E.F.G.H.

Finished in 0.0 seconds.

 

4 tests, 0 assertions, 0 failures, 0 errors

---

 

Is there anything I missed?

 

Regards,

Jason

 



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ?eljko Filipin
Sent: 2007年3月7日 19:19
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] How to make sure that script run in line 
squencerather than alphabetical sequence when using load

 

Maybe this will help.

http://wiki.openqa.org/display/WTR/Test-Unit+Patch
-- 
Zeljko Filipin
zeljkofilipin.com 

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

[Wtr-general] What is the funtion in Ruby equivalent as strrchr in C

2007-03-05 Thread Jason He
Dear all,

 

I use example_logger1.rb and test_logger1.rb
C:\watir1145\examples\logging to logging, but a problem is that the
generated log file will under the same directory with test cases, 

I want put the generated logs into a separated directory.

 

The code in the example_logger1.rb is that,

logger = CoreLogger.new(File.join(File.dirname(__FILE__),
#{fileNamePrefix}_#{time}.txt) ,2, 100)

Here the  File.dirname(__FILE__) will return the directory who stores
test cases.

Now I want get the directory upper of the directory of
File.dirname(__FILE__), is there a equivalent function or Regexp in
Ruby/Watir as strrchr/substr in C to achieve this?

 

Any hint or help is appreciated.

 

Regards,

Jason

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

Re: [Wtr-general] What is the funtion in Ruby equivalent as strrchrin C

2007-03-05 Thread Jason He
Hi Charley,

 

You gave a convenient way to achieve the goal. 

By the way, I guess a double quote is missing before the last bracket in the 
second line when using expand_path().

 

Thanks very much for your help.

 

Jason

 



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charley Baker
Sent: 2007年3月6日 0:08
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] What is the funtion in Ruby equivalent as strrchrin C

 

There are quite a few ways to do this, here's one using expand_path: 

f = File.dirname(__FILE__)  # get your test directory 
puts File.expand_path(#{f}/..)  # get the directory above your test 
directory 

-Charley 

On 3/5/07, Jason He  [EMAIL PROTECTED] wrote:

Dear all,

 

I use example_logger1.rb and test_logger1.rb C:\watir1145\examples\logging 
to logging, but a problem is that the generated log file will under the same 
directory with test cases, 

I want put the generated logs into a separated directory.

 

The code in the example_logger1.rb is that,

logger = CoreLogger.new(File.join(File.dirname(__FILE__), 
#{fileNamePrefix}_#{time}.txt) ,2, 100)

Here the  File.dirname(__FILE__) will return the directory who stores test 
cases.

Now I want get the directory upper of the directory of 
File.dirname(__FILE__), is there a equivalent function or Regexp in 
Ruby/Watir as strrchr/substr in C to achieve this?

 

Any hint or help is appreciated.

 

Regards,

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] Executing all scripts at a time

2007-03-02 Thread Jason He
I use load method, such as,

Load 'test1.rb'
Load 'test2.rb'
Load 'test3.rb', etc

These test cases could run one after one and there is only one window brought 
up, although the running sequence is not according to the line sequence written 
in the script.

One thing maybe need to pay attention to is that, use global variable $ie to 
create the IE.new instance and use this variable in all test cases, rather than 
use a local variable to create that for each test case.

Regards,
Jason

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Naga Harish 
Kanegolla
Sent: 2007年3月2日 14:40
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Executing all scripts at a time

Hi,
 I am able to run all the tests by using 
require 'test1.rb'
require 'test2.rb'
require 'test3.rb'  etc.,

but when i start the test it is opening 3 windows if there are 3 tests to run, 
i have nearly 15 tests then it opens 15 windows at a time and the test is 
running only in the last window. So  How to solve this problem??
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6664messageID=19466#19466
___
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] Can Watir be paused resumed manuallywhenrunning test cases?

2007-03-01 Thread Jason He
The purpose of pausing the testing is to let people have time to check the 
status of GUI and device under test, after running some test cases or some 
steps of a test case.

 

Here, “random time length” means the time length is under the control by 
people, rather than generated by script.

 

Regards,

Jason



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ?eljko Filipin
Sent: 2007年2月28日 17:44
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Can Watir be paused  resumed manuallywhenrunning 
test cases?

 

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

I want to pause the testing process at moment and at random time 
length, and resume it latterly.

What do you want do to while script is paused? You can pause for random number 
of seconds with sleep. 
-- 
Zeljko Filipin
zeljkofilipin.com 

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

[Wtr-general] How to execute other scipts called by Watir/Ruby

2007-03-01 Thread Jason He
Dear all,

 

Because it seems that there is no available method in watir so far to
clear the popup security alert, I intend to use a workaround method such
as call other script to clear it.

 

Is anybody known how to invoke other script via Watir/Ruby, for example
to invoke AutoHotKey script?

 

Regards,

Jason

 

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

Re: [Wtr-general] Test Data Cleanup/Reset Database in a .bat

2007-03-01 Thread Jason
Here was my solution, in case others have this problem.  I used setup and the 
sqlcmd.exe utility to call the SQL statement from within the batch file.  So, 
it looks like this:

def setup
  system(sqlcmd.exe -i C:\\myproject\\CleanDatabase.sql -e -b -S x -U x -P x)
end

Cheers,
Jason
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6700messageID=19431#19431
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] How to get the localhost IP in Warit/Ruby

2007-03-01 Thread Jason He
Yeah, it works,
Thanks very much.

Jason

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris McMahon
Sent: 2007年3月2日 11:04
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] How to get the localhost IP in Warit/Ruby

On 3/1/07, Jason He [EMAIL PROTECTED] wrote:

 Hi all,

  Is there any available method to fetch the localhost's IP address?


irb(main):001:0 require 'socket'
= true
irb(main):002:0 ip_address = IPSocket.getaddress(Socket.gethostname)
= 192.168.2.106
irb(main):003:0
___
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] Can Watir be paused resumed manually when running

2007-02-27 Thread Jason He
Yeah, ruby-breakpoint could pause the application, but it depends on the 
program and the test condition.

How to catch keyboard input signal by manual to pause/resume the testing 
process, for example using CTRL+P to pause and CTRL+R to resume.

Thanks,
Jason

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Lolis
Sent: 2007年2月27日 21:06
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Can Watir be paused  resumed manually when running

I like using 

http://rubyforge.org/projects/ruby-breakpoint/

all you do is call breakpoint() and the application stops. The best part is 
that you are now at the IRB prompt so you can do all sorts of fun things :)

I setup my smoke test to call break point on any exception, i can then hop in 
and see exactly whats going on and fix it.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6704messageID=19277#19277
___
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] Can Watir be paused resumed manually whenrunning test cases?

2007-02-27 Thread Jason He
Thank you for your reply.

 

I want to pause the testing process at moment and at random time length, and 
resume it latterly.

 

Now, I want to know how to get keyboard input signal to cause ruby pause/resume.

 

Regards,

Jason



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ?eljko Filipin
Sent: 2007年2月27日 17:27
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Can Watir be paused  resumed manually whenrunning 
test cases?

 

If you need to pause for fixed time, try

sleep 1 # 1 second pause

For more functionality, see ruby-breakpoint 
(http://rubyforge.org/projects/ruby-breakpoint/ ) or ruby-debug 
(http://rubyforge.org/projects/ruby-debug/). I have not used them, but I have 
read at this list that ruby-breakpoint can pause and then resume ruby script. 
-- 
Zeljko Filipin
zeljkofilipin.com 

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

[Wtr-general] Test Data Cleanup/Reset Database in a .bat between tests

2007-02-26 Thread Jason
I have numerous TC methods within a class.  Before I execute the script, I have 
a batch file (C:\mybatchfile.bat) I run that basically resets the database and 
then performs some inserts for database setup.  The test data and scripts I am 
creating are using the same data.  

For example, I have a positive path TC that creates a user with the following 
fields: 
TC#1
Name- Jim Dandy
UN- jdandy
Email: [EMAIL PROTECTED]

The next is a negative path TC that checks that user names must be unique:
TC#2
Name- Jim Dandy
UN- jdandy
Email: [EMAIL PROTECTED]

Name- Jane Dandy
UN- jdandy
Email: [EMAIL PROTECTED]

They work if these tests are run individually.  However, when I run the class, 
they fail, since the TC#1 already created the user jdandy.

So, how can I call this batch file in between each TC, with the batch file 
completing before starting TC#2?

TIA, 
Jason
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6700messageID=19241#19241
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Can Watir be paused resumed manually when running test cases?

2007-02-26 Thread Jason He
Hi,

 

I want add the pause/resume feature into the watir testing, rather than
interrupt it and restart the whole testing process.

 

Please anybody tell me if it is possible, or is there such solution on
hand already.

 

Thanks

Jason

 

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

Re: [Wtr-general] Assert with If...Else...End not working as

2007-02-23 Thread Jason
Yes, that worked Zeljko, thank you.  

I found the example here- http://www.openqa.org/watir/watir_user_guide.html 
Go to the heading titled Validating Test Results and you'll see this snippet of 
code:if 

ie.contains_text(Reached test verification point.)
  puts: Test passed. Page contains the text: Reached test verification point.
else
  puts: Test failed! Page didn't contain text: Reached test verification 
point.
end

This is the what I was basing my test off of, with the addition of an assert.  
I guess conditional logic with asserts cannot be used?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6663messageID=19147#19147
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Assert with If...Else...End not working as specified in example

2007-02-22 Thread Jason
I have this snippet of code that I have modeled after the 'Printing Results 
When Using Assertions' in the WATIR User Guide.  My assert is working, in the 
assertion count, but the  puts message is always Test Failed.  The 'You have 
been signed in' text is verbatim what is on the IE page.  Can anyone offer 
advice as to why I am always receiving 'Test failed!'? Thanks in advance, Jason

  if assert(ie.contains_text(You have been signed in))
puts(Test passed.)
  else
puts(Test failed!)
  end
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6663messageID=19107#19107
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] How to handle the popup security alert

2007-02-01 Thread Jason He
The following code shows a case using clearSecurityAlertBox().

---

require 'watir'   # the watir controller

include Watir

require 'watir/winClicker'

 

$ie = Watir::IE.new

$ie.goto('https://10.101.4.69:4443')

 

# create a new instance of WinClicker and use it

wc = WinClicker.new

wc.clearSecurityAlertBox()

 

# other scripts #

---

 

The result is that, IE status bar shows “Opening page https://10.101.4.69:4443 
https://10.101.4.69:4443/ ”, and a “Security Alert” pops up.

However, it will stop at this point, and not go further.

 

Is there anything I missed?

 

Regards,

Jason



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charley Baker
Sent: 2007年1月27日 1:52
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] How to handle the popup security alert

 

What error are you seeing? I wasn't saying to use IE 7 to bypass the problem, 
just mentioning the differences. If you could post a snippet of code and the 
error you're getting, that would be helpful. 

-Charley 

On 1/25/07, Jason He [EMAIL PROTECTED] wrote:

I have tried several times and found that error returned when using 
clearSecurityAlertBox  push_security_alert_yes.

 

I searched the archived mailing list, not found an example showing how to make 
it happen. The Watir doesn't provider such examples too.

 

Yes, we can use IE 7 to bypass this problem, but how to solve it when use 
Windows 2000 to do the test? (As we known Windows 2000 doesn't support IE 7)

 

Regards,

Jason

 



From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] 
On Behalf Of Charley Baker
Sent: 2007年 1月26 日 13:17
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] How to handle the popup security alert

 

You can use either/or. I'm working with AutoIt internally on our own version 
based off of WindowHelper which uses AutoIt. The only trick is adding support 
for IE 7, which instead of using popups, opens a new tab. 

-Charley 

On 1/24/07, Jason He  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]  wrote:

Hi,

 

I'm using https to do the test, and I want to push the security alert 
automatically when it popups, which of the following function is available?

 

clearSecurityAlertBox (WinClicker)

 

push_security_alert_yes (WindowHelper)

 

Besides, is it necessary to judge whether that security alert popup?

 

 

Regards,

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

 

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

Re: [Wtr-general] How to handle the popup security alert

2007-02-01 Thread Jason He
The following code shows a case using push_security_alert_yes()

---

require 'watir'   # the watir controller

include Watir

require 'watir/WindowHelper'

 

$ie = Watir::IE.new

$ie.goto('https://10.101.4.69:4443')

 

helper = WindowHelper.new

helper.push_security_alert_yes()

 

# other scripts #

---

 

The result is the same as that of using clearSecurityAlertBox() method.



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jason He
Sent: 2007年2月2日 12:38
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] How to handle the popup security alert

 

The following code shows a case using clearSecurityAlertBox().

---

require 'watir'   # the watir controller

include Watir

require 'watir/winClicker'

 

$ie = Watir::IE.new

$ie.goto('https://10.101.4.69:4443')

 

# create a new instance of WinClicker and use it

wc = WinClicker.new

wc.clearSecurityAlertBox()

 

# other scripts #

---

 

The result is that, IE status bar shows “Opening page https://10.101.4.69:4443 
https://10.101.4.69:4443/ ”, and a “Security Alert” pops up.

However, it will stop at this point, and not go further.

 

Is there anything I missed?

 

Regards,

Jason



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charley Baker
Sent: 2007年1月27日 1:52
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] How to handle the popup security alert

 

What error are you seeing? I wasn't saying to use IE 7 to bypass the problem, 
just mentioning the differences. If you could post a snippet of code and the 
error you're getting, that would be helpful. 

-Charley 

On 1/25/07, Jason He [EMAIL PROTECTED] wrote:

I have tried several times and found that error returned when using 
clearSecurityAlertBox  push_security_alert_yes.

 

I searched the archived mailing list, not found an example showing how to make 
it happen. The Watir doesn't provider such examples too.

 

Yes, we can use IE 7 to bypass this problem, but how to solve it when use 
Windows 2000 to do the test? (As we known Windows 2000 doesn't support IE 7)

 

Regards,

Jason

 



From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] 
On Behalf Of Charley Baker
Sent: 2007年 1月26 日 13:17
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] How to handle the popup security alert

 

You can use either/or. I'm working with AutoIt internally on our own version 
based off of WindowHelper which uses AutoIt. The only trick is adding support 
for IE 7, which instead of using popups, opens a new tab. 

-Charley 

On 1/24/07, Jason He  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]  wrote:

Hi,

 

I'm using https to do the test, and I want to push the security alert 
automatically when it popups, which of the following function is available?

 

clearSecurityAlertBox (WinClicker)

 

push_security_alert_yes (WindowHelper)

 

Besides, is it necessary to judge whether that security alert popup?

 

 

Regards,

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

 

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

Re: [Wtr-general] How to handle the popup security alert

2007-01-25 Thread Jason He
I have tried several times and found that error returned when using 
clearSecurityAlertBox  push_security_alert_yes.

 

I searched the archived mailing list, not found an example showing how to make 
it happen. The Watir doesn’t provider such examples too.

 

Yes, we can use IE 7 to bypass this problem, but how to solve it when use 
Windows 2000 to do the test? (As we known Windows 2000 doesn’t support IE 7)

 

Regards,

Jason

 



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charley Baker
Sent: 2007年1月26日 13:17
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] How to handle the popup security alert

 

You can use either/or. I'm working with AutoIt internally on our own version 
based off of WindowHelper which uses AutoIt. The only trick is adding support 
for IE 7, which instead of using popups, opens a new tab. 

-Charley 

On 1/24/07, Jason He [EMAIL PROTECTED] wrote:

Hi,

 

I'm using https to do the test, and I want to push the security alert 
automatically when it popups, which of the following function is available?

 

clearSecurityAlertBox (WinClicker)

 

push_security_alert_yes (WindowHelper)

 

Besides, is it necessary to judge whether that security alert popup?

 

 

Regards,

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

[Wtr-general] How to handle the popup security alert

2007-01-24 Thread Jason He
Hi,
 
I'm using https to do the test, and I want to push the security alert 
automatically when it popups, which of the following function is available?
 
clearSecurityAlertBox (WinClicker) 
file:///C:/watir1145/rdoc/classes/WinClicker.html#M23 
 
push_security_alert_yes (WindowHelper) 
file:///C:/watir1145/rdoc/classes/WindowHelper.html#M63 
 
Besides, is it necessary to judge whether that security alert popup?
 
 
Regards,
Jason
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] How to run test cases in sequence rather than atthe same time?

2007-01-22 Thread Jason He
Yes, it is not required to use test unit.
 
However, it seems that test unit encapsulate some methods could handle error, 
as well as include some statistics for the test result.
 
What is the suggestion if I want to write about 200~300 standalone test cases, 
which will run in a sequence, should I use test unit or without it?
 
Could you please give some advice. Thanks.
 
Regards,
Jason



From: [EMAIL PROTECTED] 代表 ?eljko Filipin
Sent: 2007-1-19 (星期五) 8:37
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] How to run test cases in sequence rather than atthe 
same time?


You do not have to use test unit. Take a look at this.
http://www.openqa.org/watir/example_testcase.html 
https://neo/watir/example_testcase.html,DanaInfo=www.openqa.org+ 
-- 
Zeljko Filipin
zeljkofilipin.com https://neo/,DanaInfo=zeljkofilipin.com+ 
Testing is not only what I do for a living. It is also what I do for fun. 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] How to run test cases in sequence rather than at the same time?

2007-01-22 Thread Jason He
Do these test cases are compatible both running in IE and firefox? How about it 
to the test cases with/without using test unit?
 
Should each test cases need to be changed, or just change the browser name at 
the control list.
 
 
Regards,
Jason



From: [EMAIL PROTECTED] 代表 ?eljko Filipin
Sent: 2007-1-22 (星期一) 7:43
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] How to run test cases in sequence rather thanatthe 
same time?


On 1/22/07, Jason He [EMAIL PROTECTED] wrote: 

However, it seems that test unit encapsulate some methods could handle 
error


You can also handle errors in ruby without test unit. Take a look at 
Exceptions, Catch, and Throw section of Programming Ruby 
(http://www.rubycentral.com/book/tut_exceptions.html 
https://neo/book/tut_exceptions.html,DanaInfo=www.rubycentral.com+ ).




as well as include some statistics for the test result.


You can also make your own statistics.



What is the suggestion if I want to write about 200~300 standalone test 
cases, which will run in a sequence, should I use test unit or without it?


Without test unit. But, it is only what I think.

If you really like test unit, Bret made a patch for it so methods are run in 
order you define them, but I did not try it. Take a look.
http://wiki.openqa.org/display/WTR/Test-Unit+Patch 
https://neo/display/WTR/Test-Unit+Patch,DanaInfo=wiki.openqa.org+ 
-- 
Zeljko Filipin
zeljkofilipin.com https://neo/,DanaInfo=zeljkofilipin.com+  
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] error happened when calling verify_match() ...

2007-01-22 Thread Jason He
Hi,
 
 
I tried to use Verification methods 
verify file:///C:/watir1145/rdoc/classes/Watir/Assertions.html#M000186
verify_equal file:///C:/watir1145/rdoc/classes/Watir/Assertions.html#M000187  
  verify_match 
file:///C:/watir1145/rdoc/classes/Watir/Assertions.html#M000188

Included Modules (Test::Unit::Assertions )

The script as follow,
 
---
require 'watir' 
require 'test/unit/assertions'

   $ie = Watir::IE.new
..
 
   verify_match($ie.text_field(:name, user).set(admin).to_s, admin)
 
..
 
---
when run the above script, it will return the following error,
undefined method `verify_match' for #Object:0x294fa3c (NoMethodError) 
 
I also tried above other methods, will return error too.
 
I found that these methods are defined in watir/assertions.rb.
 
 
Did I miss anything when use those methods?
 
 
Regards,
Jason
 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] How to run test cases in sequence rather than at the same time?

2007-01-18 Thread Jason He
Dear all,

 

I followed the test suite under directory
c:\ruby\lib\ruby\gems\1.8\gems\watir-1.5.1.1136\unittests to write
test cases.

Each case is a separate ruby file, and they are included in a list file.

Now I meet a problem about how to control the test cases run in a
predefined sequence, which means one by one, the later must wait after
the former is finished.

 

I tried to use the following method, but it seems does work, these cases
will run almost concurrently.


--

TOPDIR = File.join(File.dirname(__FILE__), '..')

$LOAD_PATH.unshift TOPDIR

Dir.chdir TOPDIR

 

$case_list = [unittests/login_type1_case1_rt.rb,

unittests/logout_type1_case1_rt.rb

   ]

 

$case_list.each {|x| require x}


--

 

Could somebody give some idea to handle this situation, thanks very much

 

Regards,

Jason

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

Re: [Wtr-general] How to run test cases in sequence rather than at the same time?

2007-01-18 Thread Jason He
Yes, they are the subclass of Test::Unit::Testcase, each one will be a 
standalone script, and combined by a list script who will start the test.

Regards,
Jason
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord
Sent: 2007年1月19日 10:51
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] How to run test cases in sequence rather than at the 
same time?

Jason He wrote:

 I followed the test suite under directory 
 “c:\ruby\lib\ruby\gems\1.8\gems\watir-1.5.1.1136\unittests” to write 
 test cases.

 Each case is a separate ruby file, and they are included in a list file.

 Now I meet a problem about how to control the test cases run in a 
 predefined sequence, which means one by one, the later must wait after 
 the former is finished.

What do your test cases look like? Are they subclasses of 
Test::Unit::Testcase? Or are they open scripts?

Bret
___
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] How to run test cases in sequence rather than at the same time?

2007-01-18 Thread Jason He
Yes, they are the subclass of Test::Unit::Testcase, each one will be a 
standalone script, and combined by a list script who will start the test.

Regards,
Jason
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord
Sent: 2007年1月19日 10:51
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] How to run test cases in sequence rather than at the 
same time?

Jason He wrote:

 I followed the test suite under directory 
 “c:\ruby\lib\ruby\gems\1.8\gems\watir-1.5.1.1136\unittests” to write 
 test cases.

 Each case is a separate ruby file, and they are included in a list file.

 Now I meet a problem about how to control the test cases run in a 
 predefined sequence, which means one by one, the later must wait after 
 the former is finished.

What do your test cases look like? Are they subclasses of 
Test::Unit::Testcase? Or are they open scripts?

Bret
___
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] Watir presentation review?

2006-09-20 Thread Jason Alexander








Great comments, thanks
Chris!



As Charley asked
offlist, I did neglect to mention my target audience  in this case Ill
be speaking to mid-to-senior level .NET, C# developers. So, yes, I think I have
taken some things for granted and quickly dove deep into the details. But, thats
great feedback  for the User Group chat, I need to scale it back to be
even more of an introduction, and starting simple and ramping things up from
there will be perfect.



I appreciate the tips regarding
IRB and the show* and flash methods  I actually threw in my IRB slide at
the very end because I realized that IRB might help make things connect. But,
youre exactly right  its a great foundation to build upon.



Good stuff! Thanks so
much!



(and, THANKS for
catching my misspelling!)







Thanks,

-Jason 
 
 
JasonL. Alexander
 Chief
Technology Officer 

Telligent Systems, Inc. http://telligent.com w:
214.420.1333  http://JasonA.net 











From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris McMahon
Sent: Tuesday, September 19, 2006
7:18 PM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Watir
presentation review?

















I
would really appreciate it if anyone/everyone could download and review. It's
certainly not comprehensive, but meant to be a good primer. The current version
is scaled down to work within a 1 hour time frame, but once I start presenting
at User Groups I should have close to 2 hours, so I can definitely include more
topics if anyone has more ideas.











Looks good after a quick look. You clearly have a more experienced
crowd than the people that show up for the Scripting For Testers
class. Pretty quickly you're into multidimensional arrays and
stuff. 

A couple of things you might consider from the SFT class: 

That class starts with IRB and the show* and flash methods. It's a cool
intro that makes the subsequent bits easier to understand. 

After that, we click some stuff; then do some loops, then use an if
statement to check if something is true; then bring in assert methods, then
create a suite. 

Clearly you have a more sophisticated audience, but you might consider
presenting things in increasing order of complexity. I suspect that the
current presentation order will have you backtracking throughout. (But I
could very well be wrong.) 

Just BTW, you misspelled iterate on slide 16. 















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

Re: [Wtr-general] Disclaimer

2006-09-19 Thread Jason Alexander
Bret,


I'd love to volunteer with documentation efforts. While I'm not quite
adept enough, yet, to help sling code within the main codebranch, I can
write documentation and I realize that this is probably one of the
bigger needs.

What are your plans for 1.5? How can I help? :)

 
Thanks,
-Jason 
  
  
Jason L. AlexanderChief Technology Officer 
Telligent Systems, Inc.   http://telligent.com  w: 214.420.1333  
http://JasonA.net 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord
Sent: Tuesday, September 19, 2006 1:17 PM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Disclaimer

I just realized that i didn't write what i meant to write. No wonder so 
many people were agreeing with me.

What I meant to say was that 1.4 is ALSO incompletely documented, etc.

We've seen a fair amount of sarcasm and indignation on this list lately 
and it seems to be directed at the difficulty of using Watir 1.4. At 
first i was offended, but with time, i realized that it is coming from 
enough different people that i have to assume that what we are seeing 
here is only the tip of an iceberg -- that lots of people start using 
Watir with expectations that it will be far easier than it actually is. 
I want to proactively reset these expectations.

I think i also want to say something about this being a 100% Volunteer 
effort.

I'll draft a new blurb shortly. Thanks for the comments. I also have 
plans to significantly improve Watir documentation, but i plan to have 
this be based on Watir 1.5 and therefore the 1.5 project needs to move 
forward first.

Bret


Charley Baker wrote:
 I completely agree. People have to understand that while there are a
 lot of great reasons to use 1.5, it is still a work in progress and
 does take a higher level of skill and for lack of better terms,
 personal discovery, to use.

 -Charley

 On 9/18/06, Bret Pettichord [EMAIL PROTECTED] wrote:
   
 Based on recent feedback, i am thinking that we need to add the
 following information to the main Watir webpage at wtr.rubyforge.org:

   Watir 1.5 is currently under active development.
   However, it remains poorly documented. Users often have to read
 through a confusing email archive to find solutions to common
problems.
 They also should understand HTML.
   Although developers understand it easily enough, testers are often
 confused and frustrated by it.
   If you decide to use it anyway, you've been warned. Don't complain
to
 us about it.

 Comments please. I'm not joking.

 Bret
 ___
 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
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Watir presentation review?

2006-09-19 Thread Jason Alexander








Hey all,





Im doing a lunch-and-learn for my company this
Friday over Watir, and put together a slide deck and set of demos as a
quick start. 



Additionally, I also run the North Dallas .NET Users Group
where we have close to 1000 registered users, average about 110 users per
month, and have attracted nearly 300 members in a single meeting for key
speakers. I plan on presenting with this deck in the next few months, as well.
And, then possibly taking it to the other user groups in DFW (3+ other .NET
User Groups in the area).



I would really appreciate it if anyone/everyone could
download and review. Its certainly not comprehensive, but meant to be a
good primer. The current version is scaled down to work within a 1 hour time
frame, but once I start presenting at User Groups I should have close to 2
hours, so I can definitely include more topics if anyone has more ideas.



If you see any inaccuracies or places where I could use
more best practices, please let me know. Any and all feedback is welcome. I
have thick skin. J



The presentation is at: http://jasona.net/files/folders/watir/entry14.aspx



Thanks everyone!





Thanks,

-Jason 




JasonL. Alexander  Chief Technology Officer 

Telligent Systems, Inc. http://telligent.com w:
214.420.1333  http://JasonA.net 








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

Re: [Wtr-general] Delays and Pauses

2006-09-18 Thread Jason Alexander








Actually, I used sleep
5 and it worked fine. Thanks all.







Thanks,

-Jason 
 
 
JasonL. Alexander
 Chief
Technology Officer 

Telligent Systems, Inc. http://telligent.com w:
214.420.1333  http://JasonA.net 











From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jason Alexander
Sent: Monday, September 18, 2006
1:07 PM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] Delays and
Pauses





Hey guys,





Quick question, what is the best way to pause your
scripts? For example, I have an order page that takes a few seconds to go out
and hit the merchant gateway and authorize the charge. Unfortunately, my tests around
that seem to fail because it takes so long.



What is the best way to pause the script a few seconds
while waiting on the page to finish processing? 



Should I set $ie.sleeptime high before hitting the submit button,
and then setting it back afterwards (whats the default value?)?





Thanks,

-Jason 




JasonL. Alexander  Chief Technology Officer 

Telligent Systems, Inc. http://telligent.com w:
214.420.1333  http://JasonA.net 








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

Re: [Wtr-general] Do you want Watir to be more popular?

2006-09-17 Thread Jason Alexander
While I'm new to the list, and to Watir, I can only say that I think
popularity is unavoidable, unfortunately. When you build such a great
product, and have such a great team working on it, you have no choice in
the matter - it will naturally catch on.

Personally, I believe you guys are doing a great job, on product,
documentation and support. Could it be better? Of course, it always can,
but I've been more then impressed in the past two weeks. 

Typically, from what I've seen, it's rare to find a good, open source
product that has such a mature infrastructure. This is really what makes
Watir stand out for me.

I would love to see the documentation improve (the RDocs included are
sometimes helpful, but many times vague). And, overall, it would be
great to find a way to make it even easier - I've been pushing my QA
team at work to look towards Watir for testing and automation, and,
unfortunately, Watir is a bit too technical for them. Not to say they
couldn't do it, but it's a much steeper curve for them, unfortunately.

I certainly am glad to have started to use Watir, and look forward to
contributing back to it later.

 
Thanks,
-Jason 
  
  
Jason L. AlexanderChief Technology Officer 
Telligent Systems, Inc.   http://telligent.com  w: 214.420.1333  
http://JasonA.net 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord
Sent: Sunday, September 17, 2006 2:25 AM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Do you want Watir to be more popular?

I thank Jim, Richard, Paul and Charley for their posts on this topic.

The issue of popularity was first raised in the context of an
observation that from the look of our project page at Rubyforge, the
project looked dead. I've just made several changes to this page that
i think will help curious parties realize that Watir is an active
project and the current software and information are at
OpenQA. http://rubyforge.org/projects/wtr/

I would appreciate detailed suggestions if you believe that more
should be done at this location. I am also collecting suggestions for
improvement of the main website (http://wtr.rubyforge.org). Please add
your suggestions here: http://jira.openqa.org/browse/WTR-97

Do we want Watir to be more popular is a real question and an
important question. Watir is a volunteer project. There are no
companies funding it. I spend my own time on it as do all the other
volunteers. Why are we doing this? As a volunteer organization, it is
important to be clear on the goals of the volunteers and the
organization, if you can call it that.

I have, at different times, both wanted to make Watir more popular and
regret the popularity that it has had. Right now i'm leaning more on
the regret side and Charley has heard me kvetch lately about that and
his post reflects some of our conversations. There are a number of
substansive things to be done, and i'll deal with them in more detail
in later posts, but first i want to stay right on this issue of
popularity.

The question, to me, isn't a matter of popular vs. elitist, but rather
of whether Watir needs more popularity right now. And if so, whether i
should be spending my project time on this, or encouraging other
contributors to do so. To me, to make Watir more popular, you mostly
make it easier for people to learn about and use and then also get the
word out with articles and talks and blog posts.

In the releases leading up to Watir 1.4, Jonathan Kohl really took the
lead in popularizing Watir. He created the website at
wtr.rubyforge.org, commissioned a logo, wrote the users guide, and
worked with Paul Rogers on the API documentation (rdoc) and the Watir
Works article for Better Software.

But Jonathan and Paul aren't really involved in Watir 1.5, and no one
has really taken over the responsibilities that Jonathan
shouldered. Charley Baker has been helping lately with some of the
kinds of things that Jonathan did. He's been helping me managing the
bug list and has been fixing bugs.

One big job that we didn't have back with 1.4 is answering the
questions on this list. The popularity of Watir has really caused the
traffic on the list to blossom/explode. I'd like to make a special
thanks to Zeljko (that's pronounced zhel-ko, in case you didn't know)
for the help has given on the list. As i feared, opening up the
gateway to the OpenQA web forum has really increased the traffic
here.

I say fear because i have a very hard time seeing people struggle
with Watir. Personally, i would much rather have Watir be less
popular, but have the people who are using it be more successful. And
mostly i feel like the way i can do this best is not to improve the
documentation for Watir, but just make Watir easier to use and less
buggy.

Watir is not my first experience with popularity. For a while i had
the website that Google ranked number one for software testing. That
was interesting, but with time, it became more and more of a chore and
generated

Re: [Wtr-general] WIN32OLERuntimeError: unknown property or method

2006-09-15 Thread Jason Alexander
Title: Re: [Wtr-general] WIN32OLERuntimeError: unknown property or method



Thanks for everyones help!

Actually, I found a workaround of sorts -

In my tests, I would grab a div and assign it to a variable and use that variable throughout. The problem was, during the operations after the var assignment, I would do some things that would cause postbacks. And, any references after those postbacks seemed to have lost all context.

Removing the variable assignment and references and just calling straight to div() fixed all the issues.

Very interesting, though. Im not sure if this would be considered a bug, or a normal practice that I should watch out for going forward.


On 9/15/06 4:07 AM, Angrez Singh [EMAIL PROTECTED] wrote:

Hi Bret,

I agree that the bug was related to 'to_s' method but this method internally calls 'text' method which was the source of error that I have logged.

Thanks for pointing to the URL on 'openqa'.

Regards, 
Angrez

On 9/15/06, Bret Pettichord [EMAIL PROTECTED] wrote:
Angrez,

I'm pretty sure that the bug you cite only affected the to_s method
and not the text method. I don't think it relates to Jason's issue.

We've migrated all the defects to Jira. Here is the current reference: 
http://jira.openqa.org/browse/WTR-33

Bret


Angrez Singh wrote:
 Hi Jason,

 I think its a bug in the watir 1.4.1 code where the function 
 'innerText' is called instead of function 'text' while setting or
 getting the text of the element. Please check the following URL for
 more details.

 http://rubyforge.org/tracker/index.php?func=detailaid=2978group_id=104atid=487 http://rubyforge.org/tracker/index.php?func=detailamp;aid=2978amp;group_id=104amp;atid=487 
 http://rubyforge.org/tracker/index.php?func=detailaid=2978group_id=104atid=487 http://rubyforge.org/tracker/index.php?func=detailamp;aid=2978amp;group_id=104amp;atid=487 

 You can use watir 1.5 to get rid of this error or can manually change
 your 'watir.rb' file to reflect the changes. You need to change
 'element' class and in that you need to change 'text' function. In 
 that function just change 'innerText' to 'text' it should work. BTW,
 this is not a recommended method to get rid of error, you should get
 new copy of Watir.

 - Angrez

___ 
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] WIN32OLERuntimeError: unknown property or method

2006-09-15 Thread Jason Alexander
My pleasure! 

And, great follow-up - very useful information! And, some great advice
for me going forward!

Thanks so much! :)

 
Thanks,
-Jason 
  
  
Jason L. AlexanderChief Technology Officer 
Telligent Systems, Inc.   http://telligent.com  w: 214.420.1333  
http://JasonA.net 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord
Sent: Friday, September 15, 2006 2:25 PM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] WIN32OLERuntimeError: unknown property or
method

Jason Alexander wrote:
 Thanks for everyone's help!

 Actually, I found a workaround of sorts -

 In my tests, I would grab a div and assign it to a variable and use 
 that variable throughout. The problem was, during the operations after

 the var assignment, I would do some things that would cause postbacks.

 And, any references after those postbacks seemed to have lost all
context.

 Removing the variable assignment and references and just calling 
 straight to div() fixed all the issues.

 Very interesting, though. I'm not sure if this would be considered a 
 bug, or a normal practice that I should watch out for going forward.
Jason. Thanks for letting us know what the problem was.

Recently the following recommendation to use variables was posted to 
this list:
 When you're identifying an element that may may be many frames deep,
or 
 even deep within a single frame, save the element into a variable.
This 
 way Watir doesn't go through the entire search process every time you 
 use the element:

 myframe = ie.frame(:name, frame3).frame(:name,
frame4).frame(:name, 
 tframe1)
 puts myframe.html
 myframe.select_list(:name, fromedate).flash
   
 Your Watir code also ends up a lot more readable without the very long

 lines  :-) 
I think this is a bad idea because of exactly the kinds of problems that

Jason encountered.

This is a good example of how you can optimize your script for 
performance at the risk of reliability. Specifically, this approach only

works until your script initiates a new page load. After that point, any

variables you have that reference page elements will now be stale and 
you will get OLE errors if you try to use them. The problem is that 
Watir element references are not specific to a particular page, 
considered as something corresponding to a URL or set of HTML, but 
rather to a particular load of such a page. I have found that many 
testers find it confusing to have to think about the relative timing of 
Watir evaluation with respect to browser loading and therefore stopped 
encouraging the use of variables in my Watir classes for testers. Indeed

we sometimes get questions on this list from testers who have done 
exactly this and then ask why they are getting OLE errors. My 
recollection is that i've been the only one to have responded to these 
posts, so i suspect that this problem is not well understood in the 
community.

I have found that web scrapers generally need performance and understand

the how Watir interacts with the page loading, so they are eager to use 
techniques like this. But testers usually would rather pay a small 
performance penalty for return for simplicity and reliability.

Testers who like the idea of making your code easier to read, can use 
another technique that does not sacrifice reliability (nor improve 
performance):

def myframe
$ie.frame(:name, frame3).frame(:name, frame4).frame(:name,
tframe1)
end

puts myframe.html
myframe.select_list(:name, fromedate).flash  

This approach with work regardless of whether a page load happens, so 
you don't need to think about that.

The trick to making this technique work is to make sure that you have a 
valid reference to ie in the method. The easiest way to do this is to 
make the variable global (as shown here). If you know how to use 
instance variables, that can also work. Or you can pass it in as a 
parameter.

Another technique that also simplifies code is this:

def with thing, block
thing.instance_eval block
end

with ie.frame(:name, frame3).frame(:name, frame4).frame(:name,
tframe1) do
puts html
select_list(:name, fromedate).flash
end

In this case, you do need to make sure that you don't do a page load in 
the middle of the do/end block. This technique also gives you the 
performance benefits of the variable.

Bret

___
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] WIN32OLERuntimeError: unknown property or method

2006-09-14 Thread Jason Alexander








Hey all,





Im running Ruby 1.8.5, and Watir 1.4.1 on Windows
XP Pro SP2, with IE 7 RC1.



I have a test case that runs, and for some reason I get
the following exception:



 2) Error:

test_step_two_confirm(HCS_errors_test):

WIN32OLERuntimeError: unknown property or method
`innerText'

 HRESULT error code:0x80070005

 Access is denied.

 c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2180:in
`method_missing'


c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2180:in `text'


C:/Projects/HostedCS/unittests/../unittests/hcs_errors_test.rb:111:in `test_step_two_confirm'



Im not sure whats causing this actually. I
dont think Im doing anything out of the ordinary. Heres
that particular test:



 def test_step_two_confirm

 $ie.link(:text,
Get Started Now...).click

 

 $ie.button(:id,
ctl00_CenterWell_btnSubmit).click

 

 # First, make
sure we still get our base errors.

 divTwo =
$ie.div(:id, stepTwoError)


assert(divTwo.text[You must enter a valid subdomain for your
community.] != nil)


assert(divTwo.text[Invalid subdomain. Domains may only contain letters,
numbers or hyphens.] != nil)



 # Now, let's
set an invalid domain name (the first error should go away, but not the second)


$ie.text_field(:id,
ctl00_CenterWell_txtDomainName).set(telligentrocks!)

 

 $ie.button(:id,
ctl00_CenterWell_btnSubmit).click

 


assert(divTwo.text[You must enter a valid subdomain for your
community.] == nil)


assert(divTwo.text[Invalid subdomain. Domains may only contain letters,
numbers or hyphens.] != nil)

 

 # Finally,
let's enter a valid domain and make sure all errors go away


$ie.text_field(:id,
ctl00_CenterWell_txtDomainName).set(testdomain)

 

 $ie.button(:id,
ctl00_CenterWell_btnSubmit).click

 

 assert(divTwo.text[You
must enter a valid subdomain for your community.] == nil)


assert(divTwo.text[Invalid subdomain. Domains may only contain letters,
numbers or hyphens.] == nil)

 

 end



Any ideas? Im no Watir guru, so Im not sure
if this is a normal error you run into and just means something else,
basically.



TIA!





Thanks,

-Jason 












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

Re: [Wtr-general] WIN32OLERuntimeError: unknown property or method

2006-09-14 Thread Jason Alexander








Doing some Googling,
it appears that this has to do with the page still loading? Which makes sense,
I have a few elements that are causing the page to postback
(mechanism in ASP.NET). 



Assuming thats
the problem, whats the best solution in most cases? I saw where there
was some talk of a wait_until in Jira, but what can I do meanwhile?







Thanks,

-Jason 
 
 











From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of Jason Alexander
Sent: Thursday, September 14, 2006
11:15 AM
To: wtr-general@rubyforge.org
Subject: [Wtr-general]
WIN32OLERuntimeError: unknown property or method





Hey all,





Im running Ruby 1.8.5, and Watir 1.4.1 on Windows
XP Pro SP2, with IE 7 RC1.



I have a test case that runs, and for some reason I get
the following exception:



 2) Error:

test_step_two_confirm(HCS_errors_test):

WIN32OLERuntimeError: unknown property or method
`innerText'

 HRESULT error code:0x80070005

 Access is denied.


c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2180:in `method_missing'


c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2180:in `text'

 C:/Projects/HostedCS/unittests/../unittests/hcs_errors_test.rb:111:in
`test_step_two_confirm'



Im not sure whats causing this actually. I
dont think Im doing anything out of the ordinary. Heres
that particular test:



 def test_step_two_confirm

 $ie.link(:text,
Get Started Now...).click

 

 $ie.button(:id,
ctl00_CenterWell_btnSubmit).click

 

 # First, make
sure we still get our base errors.

 divTwo =
$ie.div(:id, stepTwoError)


assert(divTwo.text[You must enter a valid subdomain for your
community.] != nil)


assert(divTwo.text[Invalid subdomain. Domains may only contain letters,
numbers or hyphens.] != nil)



 # Now, let's
set an invalid domain name (the first error should go away, but not the second)


$ie.text_field(:id,
ctl00_CenterWell_txtDomainName).set(telligentrocks!)

 

 $ie.button(:id,
ctl00_CenterWell_btnSubmit).click

 


assert(divTwo.text[You must enter a valid subdomain for your
community.] == nil)


assert(divTwo.text[Invalid subdomain. Domains may only contain letters,
numbers or hyphens.] != nil)

 

 # Finally,
let's enter a valid domain and make sure all errors go away


$ie.text_field(:id, ctl00_CenterWell_txtDomainName).set(testdomain)

 

 $ie.button(:id,
ctl00_CenterWell_btnSubmit).click

 


assert(divTwo.text[You must enter a valid subdomain for your
community.] == nil)


assert(divTwo.text[Invalid subdomain. Domains may only contain letters,
numbers or hyphens.] == nil)

 

 end



Any ideas? Im no Watir guru, so Im not sure
if this is a normal error you run into and just means something else,
basically.



TIA!





Thanks,

-Jason 












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