Re: [Wtr-general] Next release ( 1.4)

2005-07-06 Thread Bret Pettichord

At 10:09 PM 7/5/2005, Paul Rogers wrote:

   can now specify a default attribute, eg
  ie.default_attribute = :id
  ie.text_field( 'abc1').set('Testing')
  there is also a default for particular element types,
  ie.set_default_attribute_for_element( :button , :id)
  ie.button( 'b1').click


I think there are problems with both the interface and the implementation 
of this. I've worked some on fixing these, but have more work to do.


I suggest removing this from the release so that we don't commit ourselves 
to an interface we don't plan to support.


Bret



_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Next release ( 1.4)

2005-07-06 Thread Bret Pettichord

At 10:09 PM 7/5/2005, Paul Rogers wrote:

Now, one of the refactorings that has taken pace has the potential to
break some code. I doubt it will happen to many people. If you are using
code like the following in your scripts, please can you let me know, so
we can try to accommodate you.

   Class ObjectActions
def my_own_special_mrthod
# some code
end
   end

Im sure not many, if anyone is doing this, but please let me know if you
are.


I renamed an internal class. Anyone using watir needs to understand that 
some interfaces are supported and others are internal to the tool, aren't 
intended for public consumption, and are subject to change.


The class was renamed to Elements -- if you happen to have been referencing 
this class all you have to do is use the new name.


Bret


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Next release ( 1.4)

2005-07-06 Thread Bret Pettichord

At 11:18 AM 7/6/2005, Chris Morris wrote:
Is there anyway to help make this clearer to using watir? I believe 
Eclipse actually goes to packaging pains to put certain classes that are 
internal in packages called, internal, so it's hard for a user not to 
know they're working against interfaces that could change out from under them.


This is a good idea. But i don't know if we're going to have this in place 
for 1.4.


My understanding is that the only published/supported class is Watir::IE. 
Are there any others?




_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Exists? Supported for frames?

2005-07-12 Thread Bret Pettichord

exists? does not work for frames.

In this case, you can just do:
  assert(ie.frame(main))

At 06:45 PM 7/11/2005, Tuyet Cong-Ton-Nu wrote:

in irb mode as well as within the script, I got this error when trying to 
test for exists? for a frame:






error result from irb mode:

irb(main):009:0 assert(ie.frame(main).exists?)

 NoMethodError: undefined method `exists?' for #Watir::Frame:0x150458

 from (irb):9

 from C:/ruby/lib/ruby/1.8/test/unit/assertions.rb:95





error result from running a script:



C:\watir\watiranalysis.rb

Loaded suite C:/watir/watir/Analysis

Started

Started thread for win helper

E

Finished in 14.516 seconds.



  1) Error:

test_Login1(TC_Login):

NoMethodError: undefined method `exists?' for #Watir::Frame:0x2e62810

C:/watir/watir/Analysis.rb:53:in `test_Login1'



1 tests, 0 assertions, 0 failures, 1 errors



Does exists? work for a frame?


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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Still having a problem with the capture events

2005-07-12 Thread Bret Pettichord

This only works with XP SP2.

At 02:31 PM 7/7/2005, Daniel Shchyokin wrote:
In my script I am calling the IE.captureEvents followed by clicking 
a  link that opens a new window.

I then set another variable to IE.newWindow... x=IE.newWindow().
but when I try to call a method for x, say x.close(). I get an error 
stating method could not be found in Nil:nil. I ran the newWindow_test 
unit test and have the same problem. Any idea of how I can get this to work?


email: [EMAIL PROTECTED]


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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Select using Value using regular expression

2005-07-12 Thread Bret Pettichord

At 08:51 PM 7/12/2005, Tuyet Cong-Ton-Nu wrote:
I think \A should match the beginning of a string but this doesn't seem to 
work.  Any ideas?




irb(main):009:0 ie.frame(customizeRemoteContent).select_list(:id, 
availableColumnsSelectBox).select(/\ASector/)



/^Sector/


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] IE Tabstrip.htc control

2005-07-13 Thread Bret Pettichord

At 06:44 PM 7/7/2005, Alexander, Kim (Kim) wrote:
However when the page is contained in the frame the ie.goto just times 
out. Code I m using for frames is below.


$ie.frame(:index,1).goto(javascript:document.Form1.__ucMasterEntityMaintHeader_tabDefaultTabs_State__.value='2';__doPostBack('ucMasterEntityMaintHeader$tabDefaultTabs','2'))


It's a bug that there is even a goto method for frames.

I would try referencing the frame inside your javascript. Something like this:


$ie.goto(javascript:Frame1.document.Form1.__ucMasterEntityMaintHeader_tabDefaultTabs_State__.value='2';__doPostBack('ucMasterEntityMaintHeader$tabDefaultTabs','2'))




_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Maximize IE

2005-07-14 Thread Bret Pettichord

What if you start with an IE window already open and maximized?

At 12:59 PM 7/14/2005, you wrote:

I have tried closing down ALL the windows, and the only one opened is the 
DOS Command prompt window which I use to launch the ruby script.


I even maximized that window.  Nothing else is opened.  Yet, still, IE is 
launched minimized!  What a puzzle!


For my demo, I have to manually maximize it, so it's not so cool!
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


_
 Bret Pettichord
 www.pettichord.com

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


[Wtr-general] maximize that window

2005-07-14 Thread Bret Pettichord

Autoit has commands to maximize a window.

We should add ie.maximize as an interface to this.

We simply need to get the window title from ie.ie and then pass it to 
Autoit's WinMaximize.


Any volunteers?

_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Watir Recorder? write watir scripts using HTTP::Recorder

2005-07-15 Thread Bret Pettichord

At 06:53 PM 7/14/2005, saud aziz wrote:
Are there any plans on Integrating or providing scripts 
generation/recording mechanism that a user could use something like 
HTTP::Recorder of Perl to write out Watir Scripts?


No one that i know of is working on this.


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] maximize that window

2005-07-17 Thread Bret Pettichord

Thanks. I checked this in as new method ie.maximize().

I also added ie.minimize and ie.restore.

Bret

At 07:16 PM 7/14/2005, Tuyet Cong-Ton-Nu wrote:


OK, I got it working.  Easier than I thought.



Attached is the WinMaximize.rb



To use it you need to:



1) copy the WinMaximize.rb to this path:

C:\ruby\lib\ruby\site_ruby\1.8\watir



2) include at the top of the script:

require 'watir/WinMaximize'



3) add in the body of your code where you want the window to be maximized:

w = WinMaximize.new

w.maximize_window(ie.title)



It should work fine.  It worked for me!







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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Switching from Segue's SilkTest to WATIR?

2005-07-20 Thread Bret Pettichord

Tuyet,

Would you mind putting your analysis on our Wiki? I think that many people 
will find it very interesting.


(By the way i used to work for Segue.)

Bret

At 04:12 PM 7/20/2005, Tuyet Cong-Ton-Nu wrote:

I am wondering if anyone out there is in the process or has already 
switched from Segue s SilkTest to WATIR.


Any feedback on how the process went or is going for you would be appreciated?

We have adopted Segue s SilkTest to automate our Web application a few 
years ago, but we are not happy with how unreliable, hard to maintain, and 
slow it has performed.


After the demo I gave this morning, we want to pursue investing more time 
in WATIR.


So, first of all, thanks for all your help!  You are a great community!



Any feedback on SilkTest to WATIR conversion is appreciated.



By the way here are some benchmark stats that are interesting to know.

We picked 2 scripts Import and Analysis/Positions and coded the exact 
steps for both WATIR and SilkTest.


We ran the scripts about 15 times each in both WATIR and SilkTest and here 
are the results:




Import script

Watir

SilkTest

Lines of Codes



60 lines of code

200+



Elapsed Time (average of 15 runs)



25 seconds

60 seconds

Reliability



No failure when ran 15 times in a row

87% with 15 runs

Maintainability



All changes are readily seen via View Source or getHTML command.

Compare files can be done and changes can easily be made.

Changes in B1 code require updates to the page declarations. This can take 
between 10 and 30 minutes.






Analysis/Positions  script

Watir

SilkTest

Lines of Codes



105 lines of code

250+

Elapsed Time (average of 15 runs)



52 seconds

120 seconds

Reliability



No failure when ran 15 times in a row

80% with 15 runs

Maintainability



All changes are readily seen via View Source or getHTML command.

Compare files can be done and changes can easily be made.

Changes in B1 code require updates to the page declarations. This can take 
between 10 and 30 minutes.





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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Read data from excel file without open Excel Application?

2005-07-21 Thread Bret Pettichord

excel['Visible'] = false

At 04:10 AM 7/21/2005, Hue Mach Dieu wrote:

Hi All
I would like read data from excel file without open Excel Application.
This is my code read data from excel must be open Excel Application

require 'win32ole'

excel = WIN32OLE::new('excel.Application')

workbook = excel.Workbooks.Open('test.xls')

worksheet = workbook.Worksheets(1) #get hold of the first worksheet

worksheet.Select

excel['Visible'] = true

# read data from 1 cell
puts Read 1 cell
cell_A2 = worksheet.Range('a2')['Value']  #get value of single cell
puts cell_A2

Thank you for help


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


_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] Tabbing through website

2005-07-21 Thread Bret Pettichord

At 09:45 AM 7/21/2005, Cain, Mark wrote:

Would this also work for sending other keyboard commands?  E.g. {ALT +
A}


Yes


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Access is denied and Exception Errors

2005-07-22 Thread Bret Pettichord
-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


_
 Bret Pettichord
 www.pettichord.com


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


Re: [Wtr-general] Expanding JavaScript-based TreeViews

2005-07-22 Thread Bret Pettichord

At 03:46 PM 7/22/2005, Mike wrote:
P.S.  I'm finding some method aliases, like show_divs and 
showDivs.  Should I be ignoring one or the other?


Use the one with the underscores. We'll be moving stuff like showDivs into 
a optional package soon, so that they will be only available when 
specifically requested (for legacy code).



_
 Bret Pettichord
 www.pettichord.com

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


[Wtr-general] new support for referencing frames

2005-07-22 Thread Bret Pettichord
I have committed changes that allow you to reference frames using id's or 
regexps:


ie.frame(:name, /foo/)

ie.frame(:id, 'whatever')

Bret



_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Access is denied and Exception Errors

2005-07-25 Thread Bret Pettichord

At 05:06 PM 7/25/2005, Tuyet Cong-Ton-Nu wrote:
irb(main):005:0 ie.frame(main).text_field(:name, 
UserId).fire_event(onFocus )


try ie.text_field(:name, 'UserId).fire_event('onFocus')

Watir won't work with frames served by different servers. I'm giving you a 
way to keep that from happening.



_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Access is denied and Exception Errors

2005-07-25 Thread Bret Pettichord
if one frame is hosted by web1.company.com and the other is hosted by 
web2.company.com, you will run into a cross-site scripting limitation and 
get an access is denied error. load-balancing will do this.


your engineer's response does not explain why you only see the problem on 
one environment.


At 06:04 PM 7/25/2005, Tuyet Cong-Ton-Nu wrote:
I checked with the engineer that knows the hardware/software configuration 
of this application and forwarded him your take on why the error is 
generated, and here is his answer:


I don't think this is the case. All the requests are being processed from 
one domain. I think the microsoft issue is more in line with a solution...


This is the Microsoft issue that I stumbled upon.  I ve been trying to get 
the download of this HotFix from MS, but it s not working.  The support 
person I talked to was not very competent.  I will have to try 
again.  Just want to let you know and get your feedback on this.  Thanks.


http://support.microsoft.com/?kbid=889407
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] bug resolution

2005-07-26 Thread Bret Pettichord

At 07:24 PM 7/25/2005, [EMAIL PROTECTED] wrote:

http://rubyforge.org/pipermail/wtr-general/2005-June/002240.html

will this bug be fixed with the new release of watir? (pls see link above)


No. Currently the best approach is to spawn a new process.

and what's correct way of invoking WIN32OLE.new('Shell.Application') with 
internet explorer in Watir?


Uh, however you want. I don't understand the question.


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] RE: Click OK button on Popup Dialog?

2005-07-26 Thread Bret Pettichord

At 08:07 PM 7/25/2005, Hue Mach Dieu wrote:

Hi
I define click popup method like this:

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 ==
__FILE__
require 'watir'
require 'watir/WinClicker'
include Watir

def startClicker( button , waitTime = 0.5)
w = WinClicker.new
longName = $ie.dir.gsub(/ , \\ )
shortName = w.getShortFileName(longName)
c = start rubyw #{shortName }\\watir\\clickJSDialog.rb #{button
} #{waitTime} 
puts Starting #{c}
w.winsystem(c )
w=nil
end

#Then I call it...

startClicker (OK, 3)

#Then I click the button that produces the popup.

ie.frame(rightframe).frame(search).button(:name, Submit).click

but I get the error like this

../Util/clickPopup.rb:8:in `startClicker': undefined method `dir' for
nil:NilClass (NoMethodError)

Thank for help


This error message is telling you that $ie is nil. I'm not sure what you 
are trying to do with $ie.dir.gsub...






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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] RE: Click OK button on Popup Dialog?

2005-07-26 Thread Bret Pettichord

Take a look at WindowHelper.rb.

At 01:03 AM 7/26/2005, Hue Mach Dieu wrote:

Hi All,
Could you please give me an example do the click OK button in popup
dialog

Thank for help!

Hue


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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] bug in text_field.to_s

2005-07-26 Thread Bret Pettichord

Thanks for the report. It's been logged.

http://rubyforge.org/tracker/index.php?group_id=104atid=487

At 09:31 AM 7/26/2005, you wrote:

There seems to be a bug in text_field.to_s:

-
HTML (valid):

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;

-
IRB:

irb
require 'watir'
ie = Watir::IE.attach(:title, //)
ie.textField(:index, 1).to_s
-
OUTPUT:

WIN32OLERuntimeError: Unknown property or method `size'
HRESULT error code:0x80020006
  Unknown name.
from C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3470:in
`method_missing'
from C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3470:in `size'
from C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3480:in
`text_string_creator'
from C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3490:in `to_s'
from (irb):3
from :0
-
It works just fine if instead of

textarea rows=2 cols=10
/textarea

there is

input type=text /

or

input type=password /.

Zeljko

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


_
 Bret Pettichord
 www.pettichord.com

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


[Wtr-general] how to tell what version you are using

2005-07-26 Thread Bret Pettichord

ruby -e 'require watir; puts Watir::IE::VERSION'

_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] RE: Click OK button on Popup Dialog?

2005-07-28 Thread Bret Pettichord
I've been trying to understand this all better myself and once i do, i 
think i want to rework the code that we have so that users don't have to 
think about threads or processes -- that really should be handled by the tool.


Like i said, i'm still trying to track down all the facts -- but at this 
point it seems to me that WindowHelper (and thus AutoIT) can be called from 
the same process (different thread) wheras winclicker needs to be in a 
separate process. True?


Bret

At 08:57 AM 7/27/2005, Raghu Venkataramana wrote:

Chris McMahon wrote:


On 7/26/05, Scott Hanselman [EMAIL PROTECTED] wrote:



Why do folks do all this tricky stuff with Winclicker and starting new
instances of the ruby process?

I do this:

  Thread.new { sleep 0.1; WindowHelper.new.push_alert_button }
  ie.link(:id, whatever).click #this causes an Alert()



I discovered this myself independently:  the way to handle popups is
in another thread.



Those unfamiliar with threads accomplish the same
thing by handling popups in another process altogether.
Not entirely true. What we found here was that most of the times,  when a 
modal
dialog pops up, the calling process and all its child threads wait for the 
modal dialog to be dismissed
before continuing executing. Spawning another process solves this problem. 
In fact, in one of
my experiments I found that even when a child thread opens a modal dialog, 
the owner thread
also waits till the dialog is dismissed. ( I was trying to check if it is 
possible to call some of the
potential dialog creators like clicking etc., could be started off on a 
separate thread)



(Some silly
people have handled popups with an entirely different script running
in another scripting *language* altogether...)
-Chris

___
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


_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] RE: image.to_s

2005-07-30 Thread Bret Pettichord

At 05:45 PM 7/27/2005, Paul Rogers wrote:

At some point I think we want to add a elements iterator that goes
through all the items on the page, and I guess having the type available
may help


Before we do this, i'd like to see all the iterators bound to Watir 
objects, rather than COM objects. And that means that first we would need 
to support


ie.element(:name, 'foo').click

which would click on the first element (of any type) with the name 'foo'.

This week, Elisabeth Hendrickson showed me some cool stuff that essentially 
would depend on this kind of functionality.


Bret


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Help Object Repository?

2005-07-31 Thread Bret Pettichord
This is high on my list to make this work. Many people expect it to work 
this way and are surprised when it doesn't.


Last week i paired with Elisabeth Hendrickson and Andy Tinkham and we 
started working on what it would take to implement this.


Bret

At 08:45 PM 7/28/2005, Hue Mach Dieu wrote:


Dear ALL,
Does anyone have define all object in one file and these object
reference by other test cases like [QuickTest Pro] or [Silktest] object
repository

# ObjectRepository
require 'watir'
include Watir

@ie = IE.new
@obj_leftFrame = @ie.frame(leftframe)
@obj_btnSubmit = @ie.frame(rightframe).button(:name, Submit)

I create test case
# testcase

..
@ie('http://localhost:8080')
...
@obj_btnSubmit.click


But it don't work

Thank you for help


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


_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] (possibly) Introducing WatirMaker

2005-07-31 Thread Bret Pettichord

At 10:27 AM 7/28/2005, Michael Kelly wrote:

There's no reason why it couldn't be written in Ruby, no?


The support for working with events in Ruby's WIN32OLE library is extremely 
limited.


You can take a look at the code for IE#capture_events -- this pretty much 
pushes the limits of what you can do with events using the current WIN32OLE 
implementation. Undoubtedly, .Net gives much better support for COM.


It would be really cool if someone were to beef up the WIN32OLE library to 
provide better support here -- this would require some C programming.


Bret


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Pop up handling improvements

2005-08-01 Thread Bret Pettichord
I have a scheme that doesn't require this code to be in separate ruby files 
at all. I've tested it out and it works.


Right now, using this code looks like this:

ie.remote_eval -END
  button(:name, 'foo').click
END
dialog.button('Yes').click

I'd appreciate comments on this interface, and the names it uses 
(remote_eval, dialog).


Note that the first button click is run in a separate process (that 
blocks). This allows the script actions to appear in a logical sequence, 
rather than the inverted one that you need when the dialog button click is 
in the remote process.


Bret


At 01:31 PM 7/27/2005, Paul Rogers wrote:

The scripts that handle pop ups are in the unit test directory

jscriptExtraAlert.rb
jscriptExtraConfirmCancel.rb
jscriptExtraConfirmOk.rb
jscriptPushButton.rb

I suggest we move these to a better location -

The C:\ruby\lib\ruby\site_ruby\1.8\watir seems like the best place ( or
maybe another dir below)

We can then maybe add some methods to launch these from watir directly -


ie.launch_js_confirm_clicker()

Or similar. I think this would be one small step to making these popups
easier to deal with.

Any suggestions?

Paul


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


_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] irb: Terminate Batch Job message?

2005-08-01 Thread Bret Pettichord

This uses an unsupported API.

At 07:55 PM 7/29/2005, Tim Feltham wrote:

ie = IE.new(true)   # the true tells it to not open an IE window
ie.attach_init(WindowTitle)   # whatever the title of your window is


The correct way is:

ie = IE.attach(:title, WindowTitle)


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] irb: Terminate Batch Job message?

2005-08-01 Thread Bret Pettichord

I discussed this at length last week with Brian Marick.

He claims that you should be able to do ctrl-c in IRB and have it reset, 
without losing history etc. This would be useful if you get in a situation 
where you have unmatched quotes and parens and the like. He gets this all 
the time on his Mac and has seen it work right on Windows too.


The problem is the windows batch script intercepts the ctrl-c before IRB 
can get it.


The solution is to directly start irb without using the batch file. Thus:

C:\ruby c:\ruby\bin\irb
irb(main):001:0 lets mess things up(
irb(main):002:1 a
irb(main):003:1 why isn't irb working?
irb(main):004:1 ^C
irb(main):004:0 puts 'now it is fixed'
now it is fixed
= nil


At 07:35 AM 7/30/2005, Chris Morris wrote:

Tuyet Cong-Ton-Nu wrote:


I don't know how to get back to irb when it gives me this message:

Terminate batch job Y/N?

It doesn't matter if I say Y or N, it terminates irb and sends me back to 
the command prompt which is not what I want when


I select N.
The terminate batch job Y/N is not a part of irb itself, that's a 
Windows thing. I believe the Windows installer for Ruby (which is not part 
of the official Ruby release, but a separate project) creates this batch 
file to make launching irb a simpler thing to do. The underlying problem 
in your case is figuring out why irb is terminating suddenly. Once you get 
the prompt to terminate the batch job or not, irb is already lost, which 
is why answering N does no good. If you can figure out what sort of steps 
lead to this behavior and post them here or to the Ruby list, maybe you 
can get some better assistance.


--
Chris
http://clabs.org/blogki

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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Create an Equivalent of Segue's TestPlan in Watir?

2005-08-01 Thread Bret Pettichord

It's very easy:

# testplan.rb
require 'login.rb'
require 'analysis.rb'

that's it.

At 09:11 PM 8/1/2005, Tuyet Cong-Ton-Nu wrote:


I d like to create a Test Plan that contains 2 or more test cases.

How do I do that? I read the WATIR User Guide p.18/19, and tried to copy 
what s there, but nothing got executed.


I have two test cases:

1) login.rb

2) analysis.rb



1) This is the outline of Login.rb:

class TC_Login  Test::Unit::TestCase

def test_b_Login1

lots of WATIR code here methods, etc.

End

End



2) This is the outline of Analysis.rb:

class TC_Analysis  Test::Unit::TestCase

def test_a_analysis1

lots of WATIR code here methods, etc.

End

End



3) TestPlan.rb containing both of these test cases should like this?

require 'test/unit'

require 'test/unit/ui/console/testrunner'

require 'watir/windowhelper'

require 'watir/testUnitAddons'

require 'login.rb'

require 'analysis.rb'



class TC_TestPlanA  Test::Unit::TestCase

def test_a_analysis1

   what should be here in this space?

end



   def test_b_login1

   what is should be here in this space?

end

end



4) One the DOS-prompt, I do this:

 TestPlan.rb



I know I am missing something crucial here because nothing is running.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] RE: file_field.set

2005-08-01 Thread Bret Pettichord
I don't understand this request. Can you show the html that includes the 
title for a checkbox? I didn't realize this was possible.


Bret

At 07:26 AM 8/1/2005, Zeljko Filipin wrote:

I would also like title support for other html elements (like checkbox).

Zeljko

-Original Message-
From: Zeljko Filipin [mailto:[EMAIL PROTECTED]
Sent: Monday, August 01, 2005 1:26 PM
To: wtr-general@rubyforge.org
Subject: file_field.set

1) After I do:

ie.file_field(:index,1).set('C:\file.txt')

I get:

Starting win setFileDialog in new process. Setting text C:\file.txt
Starting app: C:/ruby/lib/ruby/site_ruby/1.8/watir/setFileDialog.rb
C:\file.txt

Is there a way to do this without this output?

2) After I do (there is a file field with this title at page):

ie.file_field(:title,'title').set('C:\file.txt')

I get:

C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1939:in `assert_exists': Unable to
locate object, using title and Document filename
(Watir::Exception::UnknownObject
Exception)
from C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3099:in `set'
...

Will title be supported for file fields? I would like it.

Zeljko

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


_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] Using Asserts

2005-08-02 Thread Bret Pettichord

Works for me:

irb(main):010:0 require 'test/unit/assertions'
= true
irb(main):011:0 include Test::Unit::Assertions
= Object
irb(main):012:0 assert(true)
= nil
irb(main):013:0 assert(false)
Test::Unit::AssertionFailedError: false is not true.
from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:30:in `assert_block'
from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:28:in 
`_wrap_assertion

'
from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:28:in `assert_block'
from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:40:in `assert'
from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:38:in 
`_wrap_assertion

'
from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:38:in `assert'
from (irb):13
irb(main):014:0

At 05:08 PM 8/2/2005, Jonathan Kohl wrote:

I haven t been able to get assertions to work in IRB when using Watir 
either.  I do a require for both Watir and test::unit, but it gets into a 
strange state. I wanted to do this for live demos, but have had to 
hand-wave at this point, and then run a script that prints out the 
assertions. Maybe someone else has a suggestion.




Out of curiosity, why do you want to do this in IRB instead of saving the 
tests in test files?




-Jonathan





--
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Tuyet Cong-Ton-Nu

Sent: August 2, 2005 4:04 PM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] Using Asserts



I still can t get Asserts commands to work in the irb.

I got all the require statements correctly (they return true), but here 
are some asserts statements that don t give me back anything.


Maybe I don t know how to use them or decipher whether it s true or false:



irb(main):046:1 assert_true(ie.contains_text(none)

irb(main):047:2 assert_true(ie.contains_text(%%%none)

irb(main):048:3 rescue = e

irb(main):049:3 puts e

irb(main):050:3 I get nothing here!  I expected it to fail since there is 
no such text on my IE page



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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Using Asserts

2005-08-02 Thread Bret Pettichord

You need to balance your parentheses.

At 05:04 PM 8/2/2005, Tuyet Cong-Ton-Nu wrote:


I still can t get Asserts commands to work in the irb.

I got all the require statements correctly (they return true), but here 
are some asserts statements that don t give me back anything.


Maybe I don t know how to use them or decipher whether it s true or false:



irb(main):046:1 assert_true(ie.contains_text(none)

irb(main):047:2 assert_true(ie.contains_text(%%%none)

irb(main):048:3 rescue = e

irb(main):049:3 puts e

irb(main):050:3 I get nothing here!  I expected it to fail since there is 
no such text on my IE page



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


_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] I have a couple of questions...

2005-08-03 Thread Bret Pettichord

At 10:05 PM 8/2/2005, Paul Rogers wrote:

Im not
sure, as there is nothing preventing you from having the same name or id
on html tags in the page.


It's non-conformant HTML if it has duplicate id's on a page (duplicate 
names are kosher).



_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] Checkboxes with Similar Names

2005-08-04 Thread Bret Pettichord

At 12:57 PM 8/4/2005, Paul Rogers wrote:

 note I didn't put a comma or anything in between value and 35, as Im
not sure what would be best
   ie.check_box(:name, 'foo', :value , 35)
 or
   ie.check_box(:name, 'foo', :value = 35)


i would say it should either be
  ie.check_box(:name, 'foo', :value, 35)
or
  ie.check_box({:name = 'foo', :value = 35})

(and either way, i'd make it work for all attributes and elements, not just 
check boxes.)


Comments? I actually lean for the latter: it's a hash, which is a 
convenient data structure. It may be new to the typical Watir user, but 
there is a lot of Ruby support for it, and experienced Watir users should 
know about it anyway -- there are lots of places where it can be useful for 
testing. (Segue to Testimonial from McMahon...)



_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Not waiting for browser to be ready

2005-08-04 Thread Bret Pettichord

At 01:40 PM 8/4/2005, Torres, Ben (HQP) wrote:

Is there a way to override the built-in wait() after I click on a button
from the browser?  I tried putting ie.wait(2) after click but it didn't
work.


ie.button().getOLEObject.click



_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] class_name attribute of Div elements

2005-08-08 Thread Bret Pettichord

take a look at div_test.rb.

At 05:17 PM 8/8/2005, Rob Lally wrote:

Hi,

I notice that in the last release the style attribute was converted to 
class_name for div elements.


I'm trying to use it to get the css class of a div, but I can't seem to 
get it to work - it doesn't return anything. Is it just me or is it broken?



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


_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] New, improved support for popup dialogs

2005-08-09 Thread Bret Pettichord

You need to run the install.rb script.

At 11:26 AM 8/9/2005, Iain wrote:

I'm getting an error whenever I add require 'watir/dialog' to any script

c:/ruby/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in
`require__': No such file to load -- watir/dialog (LoadError)
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in `require'
from V2_Setup.rb:8

I'm guesing that it's due to the way I installed it. I've never installed
Watir from the development tarball before, I always use the installer.

Can you please let me know where I should be extracting the files to?

Thanks

Iain




-Original Message-
From: Bret Pettichord [mailto:[EMAIL PROTECTED]
Sent: Monday, August 08, 2005 7:43 PM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] New, improved support for popup dialogs

I've committed the initial version of new code for supporting popup dialogs.

Using this code:
- You don't have to use separate 'mini-scripts.'
- You don't have to spawn a process.
- You don't have to spawn a thread.

This is all done for you behind the scenes.

You use it like this:

 require 'watir/dialog'
 $ie.remote_eval -END
 button(:value, 'whatever').click
 END
 dialog.button('OK').click

Note that remote_eval takes a string argument. This is the same:

 ie.remote_eval button(:value, 'whatever').click

The code in the string is evaluated in the context of an equivalent IE
object in an independent process.

See dialog_tests.rb for more examples.

I am very interested in getting feedback on the names of the interface for
this functionality: remote_eval, dialog, etc

Get the development tarball:
http://rubyforge.org/cgi-bin/viewcvs.cgi/watir/watir.tar.gz?tarball=1cvsroo
t=wtr

This code currently supports simple dialogs. Next is to add support for the
authorization dialogs -- a frequently requested thing. I really would like
to have unit tests for this, which means i need a quick server that does
authorization. Anyone know how to roll one with webrick?


_
  Bret Pettichord
  www.pettichord.com



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


_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] New, improved support for popup dialogs

2005-08-09 Thread Bret Pettichord

You should be fine.

I've committed a fix to the installer to avoid this problem in the future. 
The problem is due to the fact that the rdocs aren't in the tar ball.


Bret

At 12:14 PM 8/9/2005, Iain wrote:

Thanks, hindsight is a wonderful thing ...

I can get dialog_tests.rb to run without issues now although the installer
gave an error message.

Is this anything to be concerned about?


Going to install to C:\Program Files\WATIR with startMenu=1 and desktop=0
Copying Files
watir.rb - c:\ruby\lib\ruby\site_ruby\1.8/watir.rb
cp -r watir c:\ruby\lib\ruby\site_ruby\1.8
cp -r examples C:\Program Files\WATIR
cp -r unitTests C:\Program Files\WATIR
cp -r doc C:\Program Files\WATIR
cp -r rdoc C:\Program Files\WATIR
c:/ruby/lib/ruby/1.8/FileUtils.rb:525:in `stat': No such file or directory -
rdoc (Errno::ENOENT)
from c:/ruby/lib/ruby/1.8/FileUtils.rb:525:in `stat'
from c:/ruby/lib/ruby/1.8/FileUtils.rb:501:in `_copy_content'
from c:/ruby/lib/ruby/1.8/FileUtils.rb:462:in `copy_content'
from c:/ruby/lib/ruby/1.8/FileUtils.rb:461:in `preserve'
from c:/ruby/lib/ruby/1.8/FileUtils.rb:461:in `copy_content'
from c:/ruby/lib/ruby/1.8/FileUtils.rb:424:in `copy_file'
from c:/ruby/lib/ruby/1.8/FileUtils.rb:383:in `cp_r'
from c:/ruby/lib/ruby/1.8/FileUtils.rb:376:in `fu_each_src_dest'
from c:/ruby/lib/ruby/1.8/FileUtils.rb:845:in `fu_each_src_dest0'
from c:/ruby/lib/ruby/1.8/FileUtils.rb:845:in `fu_each_src_dest'
from c:/ruby/lib/ruby/1.8/FileUtils.rb:376:in `cp_r'
from install.rb:120:in `install'
from install.rb:202
from install.rb:201:in `call'
from
c:/ruby/lib/ruby/gems/1.8/gems/fxruby-1.2.2-mswin32/lib/fox12/responder2.rb:
57:in `onHandleMsg'
from install.rb:211:in `run'
from install.rb:211

-Original Message-
From: Bret Pettichord [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 09, 2005 9:33 AM
To: wtr-general@rubyforge.org
Subject: RE: [Wtr-general] New, improved support for popup dialogs

You need to run the install.rb script.

At 11:26 AM 8/9/2005, Iain wrote:
I'm getting an error whenever I add require 'watir/dialog' to any
script

c:/ruby/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in
`require__': No such file to load -- watir/dialog (LoadError)
 from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in `require'
 from V2_Setup.rb:8

I'm guesing that it's due to the way I installed it. I've never
installed Watir from the development tarball before, I always use the
installer.

Can you please let me know where I should be extracting the files to?

Thanks

Iain




-Original Message-
From: Bret Pettichord [mailto:[EMAIL PROTECTED]
Sent: Monday, August 08, 2005 7:43 PM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] New, improved support for popup dialogs

I've committed the initial version of new code for supporting popup
dialogs.

Using this code:
- You don't have to use separate 'mini-scripts.'
- You don't have to spawn a process.
- You don't have to spawn a thread.

This is all done for you behind the scenes.

You use it like this:

  require 'watir/dialog'
  $ie.remote_eval -END
  button(:value, 'whatever').click
  END
  dialog.button('OK').click

Note that remote_eval takes a string argument. This is the same:

  ie.remote_eval button(:value, 'whatever').click

The code in the string is evaluated in the context of an equivalent IE
object in an independent process.

See dialog_tests.rb for more examples.

I am very interested in getting feedback on the names of the interface
for this functionality: remote_eval, dialog, etc

Get the development tarball:
http://rubyforge.org/cgi-bin/viewcvs.cgi/watir/watir.tar.gz?tarball=1c
vsroo
t=wtr

This code currently supports simple dialogs. Next is to add support for
the authorization dialogs -- a frequently requested thing. I really
would like to have unit tests for this, which means i need a quick
server that does authorization. Anyone know how to roll one with webrick?


_
   Bret Pettichord
   www.pettichord.com



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

_
  Bret Pettichord
  www.pettichord.com



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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] class_name attribute of Div elements

2005-08-09 Thread Bret Pettichord

I've committed a fix for this.

At 01:06 PM 8/9/2005, you wrote:
I do think there is something hokey with div's though because trying to 
print out a div throws


NoMethodError: undefined method `style' for #Watir::Div:0x2d7b660
c:/tools/ruby/lib/ruby/site_ruby/1.8/watir.rb:2211:in 
`span_div_string_creator'

c:/tools/ruby/lib/ruby/site_ruby/1.8/watir.rb::in `to_s'

It seems that you missed a reference to style when you were changing it to 
className.


_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] New, improved support for popup dialogs

2005-08-09 Thread Bret Pettichord

Any object is supported, buttons, links, whatever.

At 05:21 PM 8/9/2005, Iain wrote:

controls = ie2.frame(:name, Controls)
controls.remote_eval link(:index, 2).click()
dialog.button('OK').click


Instead try this:

ie2.remote_eval frame(:name, 'controls').link(:index, 2).click()
dialog.button('OK').click

The key point is that remote_eval is a method of IE, and not of any other 
class.



_
 Bret Pettichord
 www.pettichord.com

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


Re: RE: [Wtr-general] New, improved support for popup dialogs

2005-08-09 Thread Bret Pettichord
There is a method in Ruby which is called 'eval'. It takes a string and 
evaluates it as Ruby code.


IE#remote_eval is based on this, hence the name. Python and Perl and Lisp 
all have eval methods that do the same thing, so the name is pretty well 
established and understood by anyone who has used any of these languages. 
Eval is short for evaluate, which is the name for what you do when you run 
code in an interpreted language. The equivalent with a compiled language 
would be compile, link and execute.


This varient of eval does two things in addition:
1. It evaluates in a separate process spawned by a separate thread.
2. It evaluates in the context of an IE object that is the equivalent to 
the one that invoked the method. It actually uses Ruby's instance_eval to 
do this.


People who want to learn more about what this method does would do well to 
learn more about eval and instance_eval, so it might be good to base the 
name on these methods.


Here are some other possible names:

remote_instance_eval
sub_process_eval
process_eval
parallel_instance_eval

In a way, Watir shouldn't force users to even have to understand this 
concept (and i have ideas for how to eventually get there), but since it 
does now, i'm reluctant to sugar coat it too much.


At 06:32 PM 8/9/2005, Paul Rogers wrote:

Bret,
Im assuming you've named remote_eval that based on what it is doing. I 
dont find it a very intuitive name. Maybe something like one of these:


ie.execute_command( )
ie.run_command()


I'm not sure what a 'command' is in Ruby. It's a not part of the Watir or 
Ruby lexicon.


IE#remote_eval can actually take any ruby code as its argument (in string 
form), including multiple method calls separated by semicolons or 
conditional logic or what have you. (You can embed 'puts' statements in the 
string to debug errors.)



ie.delayed_execution()  # is it actually delayed??


No. Actually the argument code and the subsequent code are running in 
parallel and either might actually be the next to be executed. Neither is 
delayed.


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


RE: RE: [Wtr-general] New, improved support for popup dialogs

2005-08-09 Thread Bret Pettichord

At 12:19 AM 8/10/2005, Scott Hanselman wrote:

Ya, I really don't like the name either, as it (deeply) exposes the
implementation, IMHO. That said, here's my hypocritical votes:

* spawn_eval
* forked_eval
* eval_newthread
* newthread_eval
* run_on_new_thread


of these, i liked forked_eval the best...


That said, why not just lie to us (as object models are wont to do) and have
the API match my intent:

ie.alert.dismiss_when_shown(:value, OK)
ie.button(:name,btnfoo).click


This is an interesting idea. It does require the inverted sequencing that i 
was trying to avoid, but the result is, overall, probably easier to understand.


Is ie.alert more intuitive than ie.dialog? What about ie.popup? One 
principle that i've tried to following in naming Watir methods is to use 
the HTML or JavaScript names for things. The JavaScript name is in fact 
alert (and confirm).


Bret


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Very slow speeds

2005-08-09 Thread Bret Pettichord
Have you tried using the -f command line switch? This speeds up our unit 
tests by a factor of 2, but the optimizations focus on text fields, so you 
may see an even better improvement.


At 11:12 AM 8/9/2005, Josh Miller wrote:
I am having a problem with slow speeds using watir (both 1.3 and 1.4). I 
have a page with about 2000 text fields 1000 of those have ID tags the 
other do not.  Navigating to this page is very fast however when the 
script is entering data into the fields via ID tags it is very slow, about 
one text field per 15 seconds.  Is this just too much for watir to handle 
quickly or should I be seeing faster speeds?


Thanks,
Josh

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


_
 Bret Pettichord
 www.pettichord.com

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


RE: RE: [Wtr-general] New, improved support for popup dialogs

2005-08-10 Thread Bret Pettichord

At 12:51 AM 8/10/2005, Tim Feltham wrote:
I haven't had a chance to use this new code yet...can I do a 
show_all_objects on the popup?

Can it select items in drop down lists yet?


No. No.


_
 Bret Pettichord
 www.pettichord.com

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


RE: RE: [Wtr-general] New, improved support for popup dialogs

2005-08-10 Thread Bret Pettichord

You are talking about Modal Web Dialogs. These include HTML.

The only way i know of for handling them is to, first, use ie.remote_eval 
to click the link or button that posts the modal (so it doesn't hang your 
script), and then use ie.send_keys to send key events to the window to make 
it go away. I don't know of any way to access the data on these kinds of 
dialogs.


The only idea i have for a really good solution would be to make sense of 
this code:

  http://support.microsoft.com/kb/q249232/

But i fear that this can't be converted to Ruby directly and therefore 
would require a C library for Watir -- and i'm too dumb for that. Volunteers?


Bret

At 01:16 AM 8/10/2005, Tim Feltham wrote:

Are you planning on putting this in at some stage?



From: [EMAIL PROTECTED] on behalf of Bret Pettichord
Sent: Wed 10/08/2005 6:00 p.m.
To: wtr-general@rubyforge.org
Subject: RE: RE: [Wtr-general] New, improved support for popup dialogs



At 12:51 AM 8/10/2005, Tim Feltham wrote:
I haven't had a chance to use this new code yet...can I do a
show_all_objects on the popup?
Can it select items in drop down lists yet?

No. No.


_
  Bret Pettichord
  www.pettichord.com

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



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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] open IE in the foreground

2005-08-10 Thread Bret Pettichord

try ie.maximize

At 05:29 AM 8/5/2005, Neumann, Carsten - ENCOWAY wrote:

Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary=_=_NextPart_001_01C599A8.39913AAE

My Watir always opens the IE in the background, can I make him open the IE 
in front of all windows?


Mit freundlichen Grüßen,



Carsten Neumann

Auszubildender



encoway GmbH

Universitätsallee 21 - 23

D-28359 Bremen



T +49 (0) 421 24677-0

F +49 (0) 421 24677-10



http://www.encoway.dewww.encoway.de

[EMAIL PROTECTED]







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


_
 Bret Pettichord
 www.pettichord.com


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


Re: [Wtr-general] choose file window

2005-08-11 Thread Bret Pettichord

At 03:41 AM 8/11/2005, Neumann, Carsten - ENCOWAY wrote:
May be he doesn t find it because in my German Windows version this window 
is called: Datei auswählen


Can that be the reason?


I think this is it. We have another report from a french speaker:

  
http://rubyforge.org/tracker/index.php?func=detailaid=1713group_id=104atid=487

Can you tell me how to create a string that contains an a-umlaut if i don't 
have a german keyboard?




_
 Bret Pettichord
 www.pettichord.com


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


Re: [Wtr-general] Help Lib Path incorrect?

2005-08-12 Thread Bret Pettichord
You are using relative paths: these are relative to the current directory 
-- not the location of the file. The current directory is where the file is 
run from. When you run from the console, you are probably running from 
the directory containing the file. By default, eclipse runs from the top of 
the project hierarchy, although this can be changed. Choose the Run... menu 
item, select the arguments tab, and change the 'working directory'.


Or you can use this:

  $LOAD_PATH. File.join(File.dirname(__FILE__), '..') if $0 == __FILE__

This makes the path relative to the location of the file, rather than the 
current directory.


Bret

At 08:36 PM 8/11/2005, Hue Mach Dieu wrote:


Hi ALL,
My structure folder as like this
My Script
-- config
   -- configLoad.xml
-- Util
   -- report.rb
-- testcases
   -- tc1.rb

I define the report.rb as like this

$LOAD_PATH  '..' if $0 == __FILE__
...
Configurator.load_xml_file('../config/configLoad.xml')
..

In tc1.rb
I use some method in report.rb

When I run it from console, don't have any problem
But when I run it within rbt (one plugin for Eclipse)
I got this error

D:/ruby/lib/ruby/site_ruby/1.8/log4r/configurator.rb:56:in `initialize':
No such file or directory - D:\MyScript/Util/config/configLoad.xml
(Errno::ENOENT)
from D:/ruby/lib/ruby/site_ruby/1.8/log4r/configurator.rb:56:in
`new'
from D:/ruby/lib/ruby/site_ruby/1.8/log4r/configurator.rb:56:in
`load_xml_file'
from D:/MyScript/Util/report.rb:25
from
D:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require__'
from
D:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require'
from D:/MyScript/testcases/tc1.rb:18

Is any incorrect with my script?
Thank you for help

Hue


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


_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] Help read data in table with Row Span

2005-08-12 Thread Bret Pettichord

Hue,

I think i actually wrote the original table to_a code. I wrote it for a 
specific table, and Paul checked it in. It was never intended to work in 
the general case.


I don't quite understand why Paul says it couldn't be fixed the way you 
want it to work. I think his concern is that it still wouldn't work in the 
general case. Figuring out how this should work in general is a hard design 
problem.


I do think any of us could write a function that worked the way you wanted. 
But this is really something that you should be able to write yourself. One 
way would be to edit the standard watir.rb. But probably a better idea 
would be to change the Table#to_a method separately. Here's how. In a 
separate file:


  class Table
def to_a
  # replacement code
end
  end

Then look at what we have a figure out how you might want to change it.

Bret

At 09:40 PM 8/10/2005, Paul Rogers wrote:


I took a quick look at this, and I don't know how we would do it. Using
my example table below, The table itself only has 2 cells on the row
after the rowspan.

Even other methods like the one below only show it has having 2 cells, I
guess cos in reality it does only have 2 cells.
irb(main):011:0 puts ie.table(:index,1).row_values(3)
c2
c3


Sorry I couldn't help more

Paul



c1c2c3
2 rowsc2c3
c2c3
Normalc2c3
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Hue Mach Dieu
Sent: 10 August 2005 19:47
To: wtr-general@rubyforge.org
Subject: [Wtr-general] Help read data in table with Row Span


Dear All,
My application table display data as like this

---
| Col 1 | Col 2 | Col 3 | ...
---
|  V1   | V2 ..
| Row 1 | -
  |  V3   | V4 ..
---
| Row 3 |  V5   | V6...
---
...

When I use method: table(..).to_a
I got this result:
= [[Col 1, Col 2, Col 3,..], [Row 1, V1, V2,..], [V3,
V4,..],Row 3, V5, V5,..] ]

Looking this result, I found this value [V3, V4,..] missing 1
column.

So any solution for this table, that mean I would like the value get
from table always don't missing any column and row in case have row span
or column span
Ex: With the case above, I would like the value I got from table as like
this:

[[Col 1, Col 2, Col 3,..], [Row 1, V1, V2,..], [nil, V3,
V4,..],Row 3, V5, V5,..] ]

Or

[[Col 1, Col 2, Col 3,..], [Row 1, V1, V2,..], [Row 1,
V3, V4,..],Row 3, V5, V5,..] ]

Thank you for help.

Hue


___
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


_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] RuntimeError: failed togetIEnumInterfaceHRESULTerror code:0x80004002

2005-08-12 Thread Bret Pettichord
This is very puzzling to me. It doesn't look like Watir can't get to the 
DOM tree. It is failing on


  ie.document.body.all

This returns a COM object, but i has no IEnum Interface.

It seems like maybe you are running a very old version of IE. Watir needs 
5.5 or later. But i think you get that automatically with XP SP 1. A puzzle.


Bret

At 10:28 AM 8/12/2005, Pascal SERODES wrote:
Yes the navigatio seems OK, the error raised even if i try to get the 
content of a text field,

Ie.text_field(:name, 'name').getContents()

Again here the stack trace:
Microsoft Windows XP [version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

D:\siouxWatir\scriptst2.rb
## Debut test: Sioux Test

Step 1: connexion a sioux:
Step 2: loggin
d:/ruby/lib/ruby/site_ruby/1.8/watir.rb:805:in `each': Failed to get IEnum 
Interface (RuntimeError)

HRESULT error code:0x80004002
  Cette interface n'est pas prise en charge from 
d:/ruby/lib/ruby/site_ruby/1.8/watir.rb:805:in getObject'

from d:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3236:in `initialize'
from d:/ruby/lib/ruby/site_ruby/1.8/watir.rb:367:in `new'
from d:/ruby/lib/ruby/site_ruby/1.8/watir.rb:367:in `text_field'
from D:/siouxWatir/scripts/t2.rb:24

At line 24 of file t2.rb i have:
ie.text_field(:name, 'j_username').getContents()


Nota: the error raised even if i try to simulate a click on a button with 
the line:

   ie.button(:name, 'Connexion').click

The initial error is on line 805 of watir.rb, looks like watir can't get 
the DOM tree?


About the OS is Windows XP, SP1, french version.
Ruby version 1.8.1.2-15
Watir 1.4.2
I just did what's is tell in the User Guide step1 to Step4 except that 
the problem arrived since step3 (dont pass the unittests step)



Is the problem link with services on windows XP?? The use of the COM 
interface may be need some extra

Setup, by the way i am the administrator of the machine.



-Message d'origine-
De : [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] De la part de Paul Rogers

Envoyé : vendredi 12 août 2005 16:46
À : wtr-general@rubyforge.org
Objet : RE: [Wtr-general] RuntimeError: failed 
togetIEnumInterfaceHRESULTerror code:0x80004002


It does the navigation ok, just doesn't do the set on a text field - is 
that right? What about other controls? Can you read values from a text field?


What OS are you using?

Paul

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Pascal SERODES
Sent: 12 August 2005 08:23
To: wtr-general@rubyforge.org
Subject: RE: [Wtr-general] RuntimeError: failed to 
getIEnumInterfaceHRESULTerror code:0x80004002



No the unittests raise the same error

-Message d'origine-
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] De la part de Paul Rogers 
Envoyé : vendredi 12 août 2005 16:09 À : wtr-general@rubyforge.org Objet
: RE: [Wtr-general] RuntimeError: failed to get IEnumInterfaceHRESULTerror 
code:0x80004002


Do the unit tests work for you?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Pascal SERODES
Sent: 12 August 2005 02:32
To: wtr-general@rubyforge.org
Subject: RE: [Wtr-general] RuntimeError: failed to get IEnum 
InterfaceHRESULTerror code:0x80004002



My script is very simple,
The error is as soon i try to set a value in a text field (line number
24)

-#
# test watir pour sioux
#
#---
-#

   require 'watir'   # the watir controller

   # set a variable
   siouxHome = 'http://localhost:8080/moa'

   # open the IE browser
   ie = Watir::IE.new

   # print some comments
   puts ## Debut test: Sioux Test
   puts   

   puts Step 1: connexion a sioux: 
   ie.goto(siouxHome)


   puts Step 2: loggin  
   ie.text_field(:name, 'j_username').set('xxx')   -- line number 24;
   ie.text_field(:name, 'j_password').set('xxx')
   ie.button(:name, 'Connexion').click


   if ie.contains_text(noErrorsOnPage)
  puts connexion effectuée
   else
  puts no good
   end

   puts   
   puts ## Fin du test

-Message d'origine-
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] De la part de Bret Pettichord 
Envoyé : jeudi 11 août 2005 17:56 À : wtr-general@rubyforge.org Objet :
Re: [Wtr-general] RuntimeError: failed to get IEnum InterfaceHRESULT error 
code:0x80004002


The error comes from this line of your script

 D:/watir-v1_4/sioux/scripts/t1.rb:24

Please show us your script.


At 04:01 AM 8/11/2005, Pascal SERODES wrote:
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
 boundary=_=_NextPart_001_01C59E53.4882DE5C

i want to use watir but i'v got these troubleshooting:


d:/ruby/lib/ruby/site_ruby/1.8/watir.rb:805:in `each': Failed to get

  IEnum Interface (RuntimeError) HRESULT error code:0x80004002

RE: [Wtr-general] I Like WET

2005-08-17 Thread Bret Pettichord

Michael,

I don't doubt your intentions and wish you best of luck. Keep us informed 
of progress.


And when you are ready for release, please set up a separate mailing list 
for all the clueless newbies who are are now going to be watir scripters!


Bret


At 01:22 PM 8/17/2005, Michael Kelly wrote:

Bret, thanks for sharing your thoughts on WatirMaker. I have similar
concerns about the utility of script recorders and caution your readers
to not expect too much from WatirMaker. It has *not* been conceived of
as a record/playback tool for non-programmers. On the contrary, at
Eleven the programmers use Watir to write UI unit tests in a test-driven
fashion. Nearly every test starts with some setup in the database using
the DataMother design pattern (a variant of the ObjectMother pattern
which can be found here:
http://www.thoughtworks.com/us/library/ObjectMother%20Website.pdf), and
concludes with one or more asserts validating specific conditions. It is
the stuff in the middle that we hope WatirMaker will facilitate.

We imagine the tool fitting nicely into a process that looks something
like this:

1. Create test skeleton (including data prep).
2. Capture Watir statements and paste into the test skeleton.
3. Modify as needed and add asserts.

In truth, I believe that we're seeking the same tool you've described as
...a tool that would show you the Watir syntax for identifying a
control or page element you point to. We've simply conceived of the
tool as a recorder.

-=michael=-

--
Michael Kelly
Sr. Software Engineer
Eleven Wireless Inc. - The Possibilities are Wireless
http://www.elevenwireless.com



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord
Sent: Wednesday, August 17, 2005 9:12 AM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] I Like WET


I really like WET and looking over its code has strongly influenced the
direction that i want to take Watir in.

For background, see this:
http://www.io.com/~wazmo/blog/

I'll have more details about what i want to do posted here shortly.

Bret


_
  Bret Pettichord
  www.pettichord.com

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

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


_
 Bret Pettichord
 www.pettichord.com

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


Re: RE: [Wtr-general] Detecting a closed IE

2005-08-17 Thread Bret Pettichord

How about just 'exists?'

Note that the algorithm below will return false if the browser is hidden. 
Is that what you want?


Bret

At 01:41 PM 8/17/2005, Paul Rogers wrote:

Do you have check in rights?

Bret, I think this would be a useful addition - is the method name corect? 
maybe Window_exists?


Paul

- Original Message -
From: Peter Chau [EMAIL PROTECTED]
Date: Wednesday, August 17, 2005 11:47 am
Subject: RE: [Wtr-general] Detecting a closed IE



 Thanx this works

 class IE
def window_exists?
begin
 return false if @ie.hWnd== -1
 return true
rescue
return false
   end
   end
 end


 if __FILE__ == $0
require 'neteller'
Test::Unit::TestCase

class TC_ie  Test::Unit::TestCase

def test_open
openIE=Watir::IE.new
assert(openIE.window_exists?)
openIE.close
end

def test_close
closeIE=Watir::IE.new
closeIE.close
assert_false(closeIE.window_exists?)
end

end
 end



 ___
 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


_
 Bret Pettichord
 www.pettichord.com

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


[Wtr-general] next steps

2005-08-17 Thread Bret Pettichord
1. finish purging all camelCase names in methods and local and instance 
variables.
2. finish renaming stuff that has the wrong name (like all the references 
to containers called 'ieController')
3. separate logic for locating objects (get_object) so it can be configured 
separately without having to what the WET people did (change overriding 
syntax).

4. rip out winclicker and autoit and use wet/winobjects instead
5. make it so that anything that be a container; refactor different methods 
currently used for this (frames  forms)


and then

6. defer invokation of COM calls until necessary

I've been pushing us this way for a while and believe that it is more 
important than ever. The simplest example of  what this means is that code 
like this will work:


  table = ie.frame(:name, 'foo').table(:index, 4)
  # do stuff
  table[3][4].button(:index, 1).click

This is convenient and often what casual users expect. Currently watir 
supports this to one level only.


Once we have this, this gives us a platform that we can do several other 
things:
a. invoke method in a separate process, so we never run into thread 
blocking problems again.
b. invoke selenium or xcom/mozilla or another browser-driving technology 
instead of IE/COM

c. attach a logger so we get cheap, decent, accurate logging



_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] next steps

2005-08-17 Thread Bret Pettichord

I wanna hear from the WET guys on this. Satti? Raghu?

There are two parts of the problem.
1. Just click the buttons and working the controls. WET has this licked.
2. Avoiding the thread-locking. WET uses a method similar to our 
IE#remote_eval. But i have ideas on how to make this better.


Bret

At 05:36 PM 8/17/2005, Jonathan Kohl wrote:

  4. rip out winclicker and autoit and use wet/winobjects
 instead
+100
We need a good solution for modal dialog boxes, alerts, popups, etc. This is
the feature I get asked about most frequently (even just a couple of hours
ago).

-Jonathan

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Bret
 Pettichord
 Sent: August 17, 2005 4:32 PM
 To: wtr-general@rubyforge.org
 Subject: [Wtr-general] next steps

 1. finish purging all camelCase names in methods and local
 and instance variables.
 2. finish renaming stuff that has the wrong name (like all
 the references to containers called 'ieController') 3.
 separate logic for locating objects (get_object) so it can be
 configured separately without having to what the WET people
 did (change overriding syntax).
 4. rip out winclicker and autoit and use wet/winobjects
 instead 5. make it so that anything that be a container;
 refactor different methods currently used for this (frames  forms)

 and then

 6. defer invokation of COM calls until necessary

 I've been pushing us this way for a while and believe that it
 is more important than ever. The simplest example of  what
 this means is that code like this will work:

table = ie.frame(:name, 'foo').table(:index, 4)
# do stuff
table[3][4].button(:index, 1).click

 This is convenient and often what casual users expect.
 Currently watir supports this to one level only.

 Once we have this, this gives us a platform that we can do
 several other
 things:
 a. invoke method in a separate process, so we never run into
 thread blocking problems again.
 b. invoke selenium or xcom/mozilla or another browser-driving
 technology instead of IE/COM c. attach a logger so we get
 cheap, decent, accurate logging



 _
   Bret Pettichord
   www.pettichord.com

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


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


_
 Bret Pettichord
 www.pettichord.com

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


[Wtr-general] another next step

2005-08-17 Thread Bret Pettichord

7. make a gem

how could i forget -- kingsley is helping me with this.

_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] next steps

2005-08-17 Thread Bret Pettichord

At 05:46 PM 8/17/2005, Paul Rogers wrote:

some other things that we should consider:

table#to_a  currently returns the cells as text. I think ( I think it was 
Bret that suggested it) this should return an array of TableCell objects
which menas we need Table#to_text_array ( or similar name). This may well 
break peoples existing code, so Im in 2 minds about it. I think it needs 
to be done, but I dont want to piss people off by having to make many changes


The way to do it is to create a file in watir/old_table.rb that reverts to 
prior behavior.


If anyone needs the old way, they can just add a require and they get it. 
I'll probably do that with the those old camelCase commands for 1.5. (I'll 
simply stop requiring watir/camel_case.rb fror watir.rb).


You can also release the new code in a separate file and get comments on it 
first, before making it part of the watir package. I've done this with the 
new IE#remote_eval method. (Which by the way, i'm prolly going to rename to 
forked_eval for now, while we still need it.)


a method to get the html className of any element - or did this already 
get in?


class_name, ahem. Yes i did that. You wrote the code, but then attached it 
to a method called 'style'.


 in many apps, on an error condition, a textfield may have a different 
color background to highlight  a mandatory field or erroronous entry, we 
could then confirm by doing

if ie.text_field(:index,1).class_name == 'ErrorClass'
# some message confirm we got the right thing
end


The next step is actually to allow ie.text_field(:class, 'ErrorClass') to 
work. This would be awesome. Actually my plan is to let any attribute be 
able to be used here. It's just a matter of writing less code -- seriously.



The exception objects should have more info, so I can do

begin
   ie.text_field(:index,1).set('foo')
rescue  ObjectDisabledException = e
   puts Object is readoly!!
   puts e.how  # displays index - maybe a better name is needed
   puts e.what # displays 1  - maybe a better name is needed
   puts e.url  # displays the url of the error
   puts e.page_title #
   puts e. anything else?
end


Maybe. I think the how and why will eventually evolve into a more complex 
structure that will allow multiple hows and whys -- like WET.


What we need is Element#inspect to describe how the object was invoked. I 
think. This is how WET redefines the to_s method. I think we need two 
methods -- one that says how the object was specified (and that probably 
also reports on container/ancestor objects) and the other that lists 
attributes in detail.


Maybe we give these two different names, neither of which is to_s or 
inspect and then these names can have a default binding to these methods, 
but this can easily be changed by frameworks (like WET) that want to do 
things different.


I am also thinking that what we really need is a hook for an exception 
handler, so people can customize it get the behavior they want.



- Original Message -
From: Bret Pettichord [EMAIL PROTECTED]
Date: Wednesday, August 17, 2005 4:31 pm
Subject: [Wtr-general] next steps

 1. finish purging all camelCase names in methods and local and
 instance
 variables.
 2. finish renaming stuff that has the wrong name (like all the
 references
 to containers called 'ieController')
 3. separate logic for locating objects (get_object) so it can be
 configured
 separately without having to what the WET people did (change
 overriding
 syntax).
 4. rip out winclicker and autoit and use wet/winobjects instead
 5. make it so that anything that be a container; refactor
 different methods
 currently used for this (frames  forms)

 and then

 6. defer invokation of COM calls until necessary

 I've been pushing us this way for a while and believe that it is
 more
 important than ever. The simplest example of  what this means is
 that code
 like this will work:

   table = ie.frame(:name, 'foo').table(:index, 4)
   # do stuff
   table[3][4].button(:index, 1).click

 This is convenient and often what casual users expect. Currently
 watir
 supports this to one level only.

 Once we have this, this gives us a platform that we can do several
 other
 things:
 a. invoke method in a separate process, so we never run into
 thread
 blocking problems again.
 b. invoke selenium or xcom/mozilla or another browser-driving
 technology
 instead of IE/COM
 c. attach a logger so we get cheap, decent, accurate logging



 _
  Bret Pettichord
  www.pettichord.com

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


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


_
 Bret Pettichord
 www.pettichord.com

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http

Re: RE: [Wtr-general] Detecting a closed IE

2005-08-17 Thread Bret Pettichord
IE.ie.visible == false is what i meant, but minimized is also a good point. 
Does a minimized browser have an hWnd?


This is complex enough that i'd just rather encourage people to use 
IE.ie.hWnd != -1 for now.


BTW, i recently checked in IE#minimize, but i didn't think that maybe it 
should be IE#minimise. Any one know the Ruby convention on this kind of 
thing. We've been using Pickaxe as our style guide, which is written by a 
Brit living in Texas, so i have no idea what his preference is offhand.


At 05:36 PM 8/17/2005, Paul Rogers wrote:
exits? sounds fine. WHat do you mean by hidden, minimised? or, behind 
another window or something else Im not thinking of?


Paul

- Original Message -
From: Bret Pettichord [EMAIL PROTECTED]
Date: Wednesday, August 17, 2005 4:17 pm
Subject: Re: RE: [Wtr-general] Detecting a closed IE

 How about just 'exists?'

 Note that the algorithm below will return false if the browser is
 hidden.
 Is that what you want?

 Bret

 At 01:41 PM 8/17/2005, Paul Rogers wrote:
 Do you have check in rights?
 
 Bret, I think this would be a useful addition - is the method
 name corect?
 maybe Window_exists?
 
 Paul
 
 - Original Message -
 From: Peter Chau [EMAIL PROTECTED]
 Date: Wednesday, August 17, 2005 11:47 am
 Subject: RE: [Wtr-general] Detecting a closed IE
 
  
  
   Thanx this works
  
   class IE
  def window_exists?
  begin
   return false if @ie.hWnd== -1
   return true
  rescue
  return false
 end
 end
   end
  
  
   if __FILE__ == $0
  require 'neteller'
  Test::Unit::TestCase
  
  class TC_ie  Test::Unit::TestCase
  
  def test_open
  openIE=Watir::IE.new
  assert(openIE.window_exists?)
  openIE.close
  end
  
  def test_close
  closeIE=Watir::IE.new
  closeIE.close
  assert_false(closeIE.window_exists?)
  end
  
  end
   end
  
  
  
   ___
   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

 _
  Bret Pettichord
  www.pettichord.com

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


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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] next steps

2005-08-17 Thread Bret Pettichord

At 10:37 PM 8/17/2005, Raghu Venkataramana wrote:

Comments inline

Bret Pettichord wrote:


I wanna hear from the WET guys on this. Satti? Raghu?

There are two parts of the problem.
1. Just click the buttons and working the controls. WET has this licked.
2. Avoiding the thread-locking. WET uses a method similar to our 
IE#remote_eval. But i have ideas on how to make this better.


Are you suggesting that every method call (or atleast the clicks, 
sets,etc.) will be called in a separate process?


I thought that was what you all did? No? Oh... now i see.

Well, yes, that was my idea.

If yes, I am concerned that this may not be the intended behavior always. 
Most of the times the desired intention
may be to wait for current line of invocation before moving on to the next 
line. I think that making this choice between
invoking a method call in a separate process should be left to the tester. 
Say, the click method could take an

optional parameter:

Click(inprocess=true)
{
}


If it is the tester's choice, i would rather they do

   out_of_process { ie.button('foo').click }

than

   ie.button('foo').click(true)

or even

   ie.button('foo').click(:out_of_process)

This is both easier to do in Ruby, and to me, in the end, easier to 
understand by humans (even if it is harder to understand by humans trained 
in procedural programming).


The second point that we need to be careful about when invoking methods 
out of process is the 'object identification'. We
need to make sure that the object identified when called in a method 
'outofprocess', is exactly the same as the object on
which the method was invoked. This could be slightly tricky (and usually 
source for errors). Consider this - If you have
a web application whose browser title is 'FooBar' and this browser opens 
more browser windows with the same title.
Making an assumption that the outofprocess method call should look for a 
browser with the title of 'FooBar' is clearly

a source for errors.


Currently, IE#remote_eval uses title for identification and could easily 
fall for the scenario you describe. But i think i want to change this so 
that it uses the hwnd instead -- that should be unique.


But i am rethinking, now that i see i misunderstood your code.


My two cents.



Bret

At 05:36 PM 8/17/2005, Jonathan Kohl wrote:


  4. rip out winclicker and autoit and use wet/winobjects
 instead
+100
We need a good solution for modal dialog boxes, alerts, popups, etc. This is
the feature I get asked about most frequently (even just a couple of hours
ago).

-Jonathan

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Bret
 Pettichord
 Sent: August 17, 2005 4:32 PM
 To: wtr-general@rubyforge.org
 Subject: [Wtr-general] next steps

 1. finish purging all camelCase names in methods and local
 and instance variables.
 2. finish renaming stuff that has the wrong name (like all
 the references to containers called 'ieController') 3.
 separate logic for locating objects (get_object) so it can be
 configured separately without having to what the WET people
 did (change overriding syntax).
 4. rip out winclicker and autoit and use wet/winobjects
 instead 5. make it so that anything that be a container;
 refactor different methods currently used for this (frames  forms)

 and then

 6. defer invokation of COM calls until necessary

 I've been pushing us this way for a while and believe that it
 is more important than ever. The simplest example of  what
 this means is that code like this will work:

table = ie.frame(:name, 'foo').table(:index, 4)
# do stuff
table[3][4].button(:index, 1).click

 This is convenient and often what casual users expect.
 Currently watir supports this to one level only.

 Once we have this, this gives us a platform that we can do
 several other
 things:
 a. invoke method in a separate process, so we never run into
 thread blocking problems again.
 b. invoke selenium or xcom/mozilla or another browser-driving
 technology instead of IE/COM c. attach a logger so we get
 cheap, decent, accurate logging



 _
   Bret Pettichord
   www.pettichord.com

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


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



_
 Bret Pettichord
 www.pettichord.com

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


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


_
 Bret Pettichord
 www.pettichord.com

___
Wtr-general mailing list
Wtr-general@rubyforge.org

Re: [Wtr-general] next steps

2005-08-17 Thread Bret Pettichord

At 10:22 PM 8/17/2005, Jeff Wood wrote:
So, when are the two projects simply going to merge? I mean, it sounds 
like all of the involved parties wouldn't mind...


Well, that is the topic under discussion. Like a marriage, there are many 
things to discuss...




_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] another next step

2005-08-18 Thread Bret Pettichord

At 12:41 AM 8/18/2005, Tim Feltham wrote:
Is there any thought of adding a
8. WATIR for firefox?

Read #6 again:


 6. defer invokation of COM calls until necessary

 I've been pushing us this way for a while and believe that it is
 more
 important than ever. The simplest example of  what this means is
 that code
 like this will work:

   table = ie.frame(:name, 'foo').table(:index, 4)
   # do stuff
   table[3][4].button(:index, 1).click

 This is convenient and often what casual users expect. Currently
 watir
 supports this to one level only.

 Once we have this, this gives us a platform that we can do several
 other
 things:
 a. invoke method in a separate process, so we never run into
 thread
 blocking problems again.
 b. invoke selenium or xcom/mozilla or another browser-driving
 technology
 instead of IE/COM
 c. attach a logger so we get cheap, decent, accurate logging


_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] another next step

2005-08-18 Thread Bret Pettichord
To be more specific, Both xcom/mozilla and selenium are technologies that 
will drive firefox.


At 12:41 AM 8/18/2005, Tim Feltham wrote:
Is there any thought of adding a
8. WATIR for firefox?

Read #6 again:


 6. defer invokation of COM calls until necessary

 I've been pushing us this way for a while and believe that it is
 more
 important than ever. The simplest example of  what this means is
 that code
 like this will work:

   table = ie.frame(:name, 'foo').table(:index, 4)
   # do stuff
   table[3][4].button(:index, 1).click

 This is convenient and often what casual users expect. Currently
 watir
 supports this to one level only.

 Once we have this, this gives us a platform that we can do several
 other
 things:
 a. invoke method in a separate process, so we never run into
 thread
 blocking problems again.
 b. invoke selenium or xcom/mozilla or another browser-driving
 technology
 instead of IE/COM
 c. attach a logger so we get cheap, decent, accurate logging


_
 Bret Pettichord
 www.pettichord.com

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


RE: RE: [Wtr-general] Detecting a closed IE

2005-08-18 Thread Bret Pettichord

$ie.ie.visible = false


At 11:12 AM 8/18/2005, Peter Chau wrote:

This code works for minimize and background IE browsers... Is there a
way to turn background on/off in the middle of a script??



require 'watir'
include Watir

class IE
def exists?
begin
 @ie.hWnd== -1
 return true
rescue
return false
   end
   end
 end


if __FILE__ == $0
require 'test/unit'

class TC_ie  Test::Unit::TestCase

def test_open
$ie=IE.new
assert($ie.exists?)
$ie.close
end

def test_close
$ie=IE.new
$ie.close
sleep 0.1   # the browser takes some time to close
assert(!$ie.exists?)
end

def test_minimize
$ie=IE.new
$ie.goto(http://www.google.ca;) # can't minimize a
blank window because it throws an error
$ie.minimize
assert($ie.exists?)
$ie.close
end

 def test_invisible_open
command_line_flag('-b')   # this doesn't work the way I want
$ie=IE.new
assert($ie.exists?)
$ie.close
 end
end
 end





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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] another next step

2005-08-18 Thread Bret Pettichord
Thanks for the reminder. I had searched my mail archive for your posts, but 
i didn't think to search for all possible spellings of your name Mr. 
Ver(k)hovsky.


At 10:33 PM 8/18/2005, Alex Verhovsky wrote:

Bret Pettichord wrote:


7. make a gem

how could i forget -- kingsley is helping me with this.


To remind, I once submitted a gemspec for Watir. It was before there were 
any native libraries in the distibution though. Anyway, Bret, if you need 
help with a gem, just whistle :)


Alexey Verkhovsky

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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] need help understanding focus error

2005-08-18 Thread Bret Pettichord

At 05:07 PM 8/18/2005, Warren Pollans wrote:

That works - but why doesn't the other work?


The object reference you stored becomes stale when a page loads or reloads. 
The same thing will happen to the value= method.



I've temporarily bypassed this particular problem by using the value=
method - just so I can get on with writing the test

On or about Thu, 18 Aug 2005 16:13:38 -0500
Bret Pettichord [EMAIL PROTECTED] allegedly wrote:

 At 03:23 PM 8/18/2005, Warren Pollans wrote:
 How can I figure out (debug) what this complaint is about:
 
 WIN32OLERuntimeError: focus
  OLE error code:8000 in htmlfile
Unexpected call to method or property access.
  HRESULT error code:0x80020009
Exception occurred.
  c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3399:in `method_missing'
  c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3399:in `set'
 
 Where can I find what the error codes mean?
 
 
 
 I have defined an instance variable:
 
  @s_fld = $ie.test_field(:name, xxx)
  zzz = some text
 
 and then called
 
  @s_fld.set(zzz)

 try this instead and tell us what happens:

$ie.text_field(:name, xxx).set(zzz)

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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] finding text in a cell that contains a specified image?

2005-08-19 Thread Bret Pettichord

At 12:47 PM 8/19/2005, Shao Kang Tat wrote:
So I'm assuming Watir will always start at index 0 when using .times 
do|x|is that right?  Would it be possible to make watir Know what 
iscalling .times so that it can start at a different index - in thiscase, 
tables?  I actually do use .times do|x| in some cases but Inever tried 
with tables until now because I assumed it would start atindex 0.

Shao


Ruby always starts at index 0.

We made a big mistake in designing Watir and used one-based indexing. The 
problems you are running into are consequences of our design error.


For example,

  ie.table(:name, 'foo')[2][3].text

is the same as

  ie.table(:name, 'foo').to_a[1][2]

This is because the first is 'watir' and the second is 'ruby', but we 
realize that everyday users will never be likely to figure this out.


We've discussed changing Watir to use zero-based indexing, but are 
concerned about compatability. Paul discussed this in a recent email. 
Comments? Anyone opposed to a switch?


Bret



_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Need advice on assert, module/class setup, and Watir

2005-08-20 Thread Bret Pettichord

I suggest that you put your library methods in a Module. Thus:

# library.rb
module MyLibrary
  def my_library_method(arg)
# code...
  end
end

# tests.rb
require 'test/unit'
require 'library.rb'

class TC1  Test::Unit::TestCase
  include MyLibrary
  def test_method
my_library_method arg
# more code
  end
end


At 04:39 PM 8/19/2005, Joe Yakich wrote:


Gurus,



I m testing a fairly complicated web application. We have been using Canoo 
WebTest for GUI testing, but we decided to try out Watir and we ve been 
very pleased with it so far.




Because of the complexity, I wanted to have a layer (a library or API type 
level) containing Watir calls and then have the test scripts themselves 
require the library classes. (Note that I am not wedded to classes if they 
are inappropriate; modules would be just fine.) I had hoped to insulate 
most of the Watir calls in the library, partly to localize changes if the 
application under test changes, partly to make writing the actual scripts 
easier for others, and partly to make the logic of the actual test case 
more apparent.




Anyway, my primary problem is this: I thought it would be convenient to 
put assert() calls in the library class (Login.rb, below), but when I do 
so and run the test script (test_login.rb, below), those assertions are 
not counted up when the test script runs, although if I introduce 
a  failure, the failure count does include the error. That is, I see this:




1 tests, 0 assertions, 0 failures, 0 errors [ when the test script passes]

1 tests, 0 assertions, 1 failures, 0 errors [ when the test script fails ]



when I was expecting this:



1 tests, 1 assertions, 0 failures, 0 errors [ when the test script passes]

1 tests, 1 assertions, 1 failures, 0 errors [ when the test script fails ]



Directly inheriting Test::Unit::TestCase in my library didn t seem to 
work, either, as then I get messages like No tests were specified.




Secondarily, if anyone has suggestions on how to better set up a similar 
library/script hierarchy, I would love to hear them. I m new to Ruby and 
Watir, so suggestions about coding style, naming, etc. are welcomed as well.




Code follows (note that I edited the code for brevity and that it s 
possible that it won t actually run, but I thought it was sufficient for 
illustration):




##

# test_login.rb

# The actual test script (edited for brevity)

##

$:.push(../../../lib)



require 'Login/Login'

require 'watir'

require 'test/unit'



class SimpleLogin  Test::Unit::TestCase

  include Watir



  @username = 'username'

  @password = 'password'

  @url = 'http://www.fake_url.com/login_page.html'



  def test_login

ie = IE.new

l = Login.new()

l.login(ie, @url, @username, @password)

  end



end



##

# Login.rb

# The Login class (edited for brevity)

##

class Login



  require 'test/unit'

  require 'test/unit/assertions'

  require 'watir'

  include Watir

  include Test::Unit::Assertions



  def login(ie, url, username, password)

ie.goto(url)

ie.link(:text, site login).click

ie.text_field(:name, username).set(username)

ie.text_field(:name, password).set(password)

ie.button(:name, 'submitBtn').click

assert(ie.contains_text(Welcome #{username}))

  end



end



##

# End of code

##



Thank you!



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


_
 Bret Pettichord
 www.pettichord.com

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


[Wtr-general] images test fails

2005-08-20 Thread Bret Pettichord

Paul,

Did you forget to check in a change to images1.html?

This test is failing in HEAD:


Loaded suite d:/workspace/watir/unittests/images_test
Started...

  1) Error:
test_image_click(TC_Images):
Watir::Exception::UnknownObjectException: Unable to locate object, using 
name and disabler_test

d:/workspace/watir/unittests/../watir.rb:1768:in `assert_exists'
(eval):2:in `disabled'
d:/workspace/watir/unittests/images_test.rb:56:in `test_image_click'

7 tests, 86 assertions, 0 failures, 1 errors


_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] installer issues

2005-08-20 Thread Bret Pettichord

At 04:37 PM 8/20/2005, Jonathan Kohl wrote:

To be fair, those were emailed to me by a developer. :)


Then he has even less of an excuse. heh.


_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] Set Debugging Breakpoint in WATIR/Ruby script?

2005-08-21 Thread Bret Pettichord

More advice from Alex:

alexey verkhovsky: typing
alexey verkhovsky: require 'breakpoint'; breakpoint
alexey verkhovsky: is too long
alexey verkhovsky: therefore, I usually have something like
alexey verkhovsky: def bp require 'breakpoint'; breakpoint; end
alexey verkhovsky: somewhere in the ap
alexey verkhovsky: this way, inserting a breakpoint is just bp
alexey verkhovsky: and it doesnt try to load brerakpoint.rb when it doesnt 
need to

alexey verkhovsky: (it's quite long to load)

BTW, i also found out that
  require 'breakpoint'
won't work in IRB.

At 06:44 PM 8/19/2005, Michael Kelly wrote:

Quoted from Alex Verhovsky:

there is this RubyForge project called 'breakpoint',
http://ruby-breakpoint.rubyforge.org/wiki/wiki.pl?HomePage, which opens
an IRB session inside a running Ruby program. With it, you can do
something like
test/watir/long_convoluted_test_script.rb
require 'watir'
include Watir
config = load_configuration
database = connect_to_database
ie = IE.start('http:/foo.bar.com/login')
ie.text_field(:id, 'username').set_value('me')
...
...
...
# somewhere in the middle
require 'breakpoint'
breakpoint
...
and this will execute the script until breakpoint and then open an IRB
session in which the actual values of ie, configuration, database are
available and even can be modified. As well as any other variable
visible from the breakpoint location. Exiting the IRB continues the
program.
This is often the easiest way to get to the state that you want to play
with. Besides, you can do conditional breakpoints
breakpoint if some arbitrarily complex condition
Bottom line: don't leave home without it.
Alex


_
 Bret Pettichord
 www.pettichord.com

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


[Wtr-general] New Installer for Watir 1.4.1

2005-08-21 Thread Bret Pettichord
Watir 1.4.1 is a minor update to 1.4.0 that includes a brand new installer. 
We think people will find this much easier to use. Thanks to Kingsley for 
providing it. It is a nullsoft-based installer.


http://rubyforge.org/frs/?group_id=104release_id=2725

Please let us know if there are problems. We also fixed the tests that were 
failing in 1.4.0.


We plan to have a gem for 1.4.1 out very shortly.

Bret

_
 Bret Pettichord
 www.pettichord.com

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


RE: [Wtr-general] Sleep statements and Attach

2005-08-21 Thread Bret Pettichord

This is a bug. Please go ahead and log it on our bug tracker.

Attach should wait a reasonable amount of time for a new window to appear. 
It should attach to the window when it appears, or else fail after a 
reasonable amount of time has passed.


(BTW, IE#wait should also fail after a reasonable amount of time has 
passed. Right now it waits forever.)


What is reasonable? The default should probably be about 5 seconds. It 
should be set as a configurable option.


To date, we have attached these kinds of configurable options to a 
particular IE object. That approach won't work here, because the IE object 
doesn't exist until IE#attach has returned.


(I've been wanting to set up configuration options as a separate object for 
a while. This situation should be taken into account.)


Bret

At 03:46 AM 8/20/2005, Zeljko Filipin wrote:
urn:schemas-microsoft-com:office:office xmlns:w = 
urn:schemas-microsoft-com:office:word

I have the same problem, but I have not found the solution yet.

Zeljko


--
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Tuyet Cong-Ton-Nu

Sent: Saturday, August 20, 2005 1:06 AM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] Sleep statements and Attach

The code below, for example, is a typical thing that I have to do in our 
application.


1)   Click on an icon to launch the Select Portfolio window

2)   The problem is that it may take the Select Portfolio window a 
little while to load,


so I have to add a Sleep parameter otherwise, the attach 
statement will fail because it can t find the title


3)   Is there a way to do this without using the Sleep statements?

4)   Also once I am done with this Select Portfolio, I close it, and 
need to reconnect back to the main window of the application to continue 
with the script and there again I have to put a Sleep statement.


5)   Any help/suggestion you have to handle this is appreciated



ie.frame(main).frame(:name, context_bar).image(:src, 
/icon_open.gif/).click


sleep 3

  ie = Watir::IE.attach(:title, Select Portfolio)



#Reconnect back to main frame

sleep 3

ie = Watir::IE.attach(:url, https://test.com/araneae/app;)
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Need advice on assert, module/class setup, and Watir

2005-08-22 Thread Bret Pettichord

This is a hard problem, that i'm still looking for a good answer.

I've spent time investigating it. The problem is that there are two 
different versions of add_assertion, the method that updates the assertion 
count.


One of them is in Test::Unit::TestCase -- and it is what you get if you do 
what Warren did below.


The other is is Test::Unit::Assertions -- and this is the one that doesn't 
actually count your assertions.


The solution? I don't know. I've been meaning to write up this problem on 
ruby-talk and see if i could get some help there with the problem.


With time i'd like to emulate WET and add methods like ie.text_field(:name, 
'foo').verify('bar') but this problem needs to get figured out first.


I suggest raising this issue on that forum.

Bret

At 10:43 AM 8/22/2005, Warren Pollans wrote:

Hello,

I have a similar problem/confusion.  My assertions are contained in
instance methods of classes defined in an external file - so I don't
think the suggestion below is applicable - at least it didn't work
when I tried it. The page I'm testing has 4 forms - forms 1 and 4 are
nearly identical (aside from form element names) and forms 2 and 3 are
also similar - so putting the assertions into instance methods seemed
the natural thing to do. My test script follows - the results show only
one assertion - in test_a.  I'd like to be able to see the total count
of assertions.  The tests work fine - I'd just like to see more
information - I am imagine I could keep the count myself but suspect
that there must be a way to have watir or test/unit do it for me.

Any suggestions would be appreciated.  I'm still very new to ruby and
watir and windows - I'm porting tests from perl and WWW::Mechanize -
Over-explaining accepted :-)

Here's my test script:

++

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 ==
__FILE__

require 'unittests/setup'  ##  from watir unittests
require 'unittests/filter_settings'  ##  classes defined here

$url = url
$uid = userid
$pas = password

class TC_filtersettings  Test::Unit::TestCase

include Watir

def setup()
$ie.goto($url)
end

def test_a_login
$ie.text_field(:name, userid).set($uid)
$ie.text_field(:name, password).set($pas)
$ie.button(:value, Login).click
$ie.wait
assert( $ie.title =~ /Email Defense Solution/, Got to
mailset_spam page )
end

##  Spam Settings
def test_b_spam
Filterbutton.new(1, spam_handling, 1).button_test()
Filterbutton.new(1, spam_handling, 2).button_test()
Filterbutton.new(1, spam_handling, 3).button_test()
end

##  Virus Settings
def test_c_virus
Filterbutton.new(4, virus_scanning, 1).button_test()
Filterbutton.new(4, virus_scanning, 2).button_test()
end

def test_d_whitelist
wl = Filterlist.new('whitelist', 'form1')
wl.clear_list()
wl.getAddlist.each {|x| wl.add2list(x[0], x[1])}
wl.getSearchlist.each {|x| wl.search_list(x[0], x[1])}
wl.delete_first()
wl.clear_list()
end

def test_e_blacklist
bl = Filterlist.new('blacklist', 'form2')
bl.clear_list()
bl.getAddlist.each {|x| bl.add2list(x[0], x[1])}
bl.getSearchlist.each {|x| bl.search_list(x[0], x[1])}
bl.delete_first()
bl.clear_list()
end
end




On or about Fri, 19 Aug 2005 19:11:48 -0500
Bret Pettichord [EMAIL PROTECTED] allegedly wrote:

 I suggest that you put your library methods in a Module. Thus:

 # library.rb
 module MyLibrary
def my_library_method(arg)
  # code...
end
 end

 # tests.rb
 require 'test/unit'
 require 'library.rb'

 class TC1  Test::Unit::TestCase
include MyLibrary
def test_method
  my_library_method arg
  # more code
end
 end


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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Load Testing with Watir?

2005-08-22 Thread Bret Pettichord
if you go this route, you may want to look at Ruby's DRB, which makes it 
really easy to coordiate between different machines.


bret

At 12:49 PM 8/22/2005, saud aziz wrote:
True, but i could set up scripts to run on different computers, say at 
most 15-20 scenarios for each machine on a total of 30 machines and get 
performance metrics out of web server. Do you think that is even a good start?




On 8/21/05, Jonathan Kohl 
mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote:
You could generate some load, but you would have Internet Explorer 
instances using a lot of resources on your test machines. Not using a 
browser and sending HTTP requests doesn't require the resources that 
multiple IE instances would, so you can generate more simulated load.


-Jonathan



--
From: 
mailto:[EMAIL PROTECTED][EMAIL PROTECTED] 
rg [mailto:[EMAIL PROTECTED] On Behalf Of saud aziz

Sent: August 21, 2005 10:13 PM
To: mailto:wtr-general@rubyforge.orgwtr-general@rubyforge.org
Subject: [Wtr-general] Load Testing with Watir?

Anyone here ever tried to create scripts that could be used for load 
testing?


What are the Con's of such approach? Would it be any effective at all in 
your opinion?




--
..man is a human being, not because of his physical powers for 
physically the camel is his superior; not because of his size for the 
elephant is larger; not because of his courage for the lion is more 
courageous; not because of his appetite for the ox has the greater; not 
because of coitus for the least of the birds is more virile than he, but 
rather by virtue of his noble aims and ideals. [As a matter of fact] he 
was only created to know. (Al- Ghazali; The book of Knowledge, Section 1)


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





--
..man is a human being, not because of his physical powers for physically 
the camel is his superior; not because of his size for the elephant is 
larger; not because of his courage for the lion is more courageous; not 
because of his appetite for the ox has the greater; not because of coitus 
for the least of the birds is more virile than he, but rather by virtue of 
his noble aims and ideals. [As a matter of fact] he was only created to 
know. (Al- Ghazali; The book of Knowledge, Section 1)


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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] WAIT statement didn't wait?

2005-08-22 Thread Bret Pettichord
The fact that you have to mess with all of this is probably a bug in the 
wait method. Can you give us more info on what preceeds this code?


In the mean time, this should do what you want:

  ie.frame(main).frame(sidebar).wait(analysisSidebarTabContent)
  sleep 3
  until (begin
   
ie.frame(main).frame(sidebar).frame(analysisSidebarTabContent).image(:src,/icon_report_positions.gif/).exists?
 rescue UnknownFrameException
   false
 end) do
  sleep 0.1
  end
  ie.frame(main).frame(sidebar).frame(analysisSidebarTabContent).image(:src, 
/icon_report_positions.gif/).click






At 06:51 PM 8/22/2005, Tuyet Cong-Ton-Nu wrote:

I used both the WAIT command and a loop with a sleep statement but they 
both didn t wait or sleep long enough ?


Here is the code:


ie.frame(main).frame(sidebar).wait(analysisSidebarTabContent)

sleep 3

while 
!ie.frame(main).frame(sidebar).frame(analysisSidebarTabContent).image(:src,/icon_report_positions.gif/).exists?


sleep 0.1

end


ie.frame(main).frame(sidebar).frame(analysisSidebarTabContent).image(:src, 
/icon_report_positions.gif/).click






Even with the WAIT command and the sleep command after the WAIT, I got 
this error on line 110 which is the while statement:


  1) Error:

test_a_analysis1(TC_Analysis):

Watir::Exception::UnknownFrameException: Unable to locate a frame with 
name analysisSidebarTabContent


c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1739:in `initialize'

c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:222:in `new'

c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:222:in `frame'

C:/watir/Analysis.rb:110:in `test_a_analysis1'



1 tests, 1 assertions, 0 failures, 1 errors
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Use Index in a Table given by SpySmith

2005-08-22 Thread Bret Pettichord

At 09:12 PM 8/22/2005, Jeff Wood wrote:

But how can I do it using the Index [137] that SpySmith gave me?


We don't support this.

And that seems to be a really bad idea anyway. Any change to the page 
layout will break this.


Bret


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Test suites

2005-08-22 Thread Bret Pettichord
How are you running your tests? Are you double-clicking on a script with 
all the requires? Instead, go to a cmd prompt and type ruby script.rb. 
Then you will see the summary.


It's being created all along, but when you double-click, there is no where 
to show it.


This is also a GUI test runner for Test::Unit. I haven't used it, but you 
may want to give it a look.


You are on the right track to run all the tests from the command line. It's 
a simple matter to then wrap this up as an ant task.


Bret

At 04:19 PM 8/22/2005, Lisa Crispin wrote:

Eventually we want to run our tests from CruiseControl, but I think
the first baby step would be actually to run a suite of tests from the
command line.  (Or maybe I'm wrong about that, maybe I should run each
test from ant, I am not sure, I am seeking advice on this).  The
test::unit doc (http://www.ruby-doc.org/core/classes/Test/Unit.html)
shows that you can simply require each test and it will magically be
run.  This works.  However, I want a summary of the results at the
end, how many tests ran, how many assertions, failures, errors, summed
for all the tests that ran.

I've googled and looked at the Scripting for Testers class materials
(Boy, I wish I could have attended that at Agile 2005, but I was
presenting at the same time), and I can't find out how to do this.  I
see there is something called 'Watir::logging' (very clever) but I
can't find any doc on how to use it (at least, not any doc that I can
make heads or tails out of).

Is there a way to run a suite of tests and get a summary of the
results at the end?

Am I better off doing this in ant from the get-go or am I correct to
look for intermediate steps?
thanks,
Lisa

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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Running IE minimized or invisible?

2005-08-22 Thread Bret Pettichord

Any of these should work...

 testscript.rb -b

ie.ie.visible = false

ie.minimize

At 02:48 PM 8/22/2005, saud aziz wrote:
Is it possible to run your tests scripting in Ruby with Watir (of course) 
either with IE minimized or invisible?


I would like to be able to work on other stuff while it does its thing 
without interrupted. Is that possible?


--
..man is a human being, not because of his physical powers for physically 
the camel is his superior; not because of his size for the elephant is 
larger; not because of his courage for the lion is more courageous; not 
because of his appetite for the ox has the greater; not because of coitus 
for the least of the birds is more virile than he, but rather by virtue of 
his noble aims and ideals. [As a matter of fact] he was only created to 
know. (Al- Ghazali; The book of Knowledge, Section 1)


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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Using Watir with javascript HTML-editor (textarea)?

2005-08-23 Thread Bret Pettichord
It looks like you have the right object, but it has been heavily customized 
-- as you know. You're probably going to have rewrite the TextField class 
to support this control.


Fundamentally that means doing ie.text_field(:id, 
/elm1/).getObject.ole_methods to see what methods are supported and then 
using trial and error and MS doc to figure out which will help you do what 
you want...


I'd start by removing the focus call.

Bret

At 12:36 AM 8/23/2005, Thomas Øhrbom wrote:

Hi!
I'm still struggling with this problem so I'm going to try this mailing 
list once more. Sorry about the repeat...


Our main product uses a javascript HTML-editor (much like TinyMCE[1]) to
let the user create documents to be published.

So far I've not managed to in any way to interact with this HTML-editor
using Watir. Neither manipulating text in the textarea nor accessing the
toolbar buttons works. When trying to input text in the textarea I
always get an error like this:

   irb(main):026:0 ie.text_field(:id, /elm1/).set(Test)
   WIN32OLERuntimeError: focus
   OLE error code:800A083E in htmlfile
 Can't move focus to the control because it is invisible, not
 enabled, or of a type that does not accept the focus.
   HRESULT error code:0x80020009
 Exception occurred.
   from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3399:in
   method_missing'
   from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3399:in `set'
   from (irb):26
   from  :0

I realize I might be trying to access the wrong object here, but I've
tried others with no luck. I've also tried using name instead of id.

If anyone can help me sorting out this problem that would be greatly
appreciated.


[1] TinyMCE is a platform independent web based Javascript HTML WYSIWYG
 editor control released as Open Source under LGPL by Moxiecode
 Systems AB. It has the ability to convert HTML TEXTAREA fields or
 other HTML elements to editor instances.
 http://tinymce.moxiecode.com/example_full.php?example=true

Kind regards,
--
Thomas Ohrbom
QA Manager, extend AS
[EMAIL PROTECTED] | http://www.extend.no/
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


_
 Bret Pettichord
 www.pettichord.com


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


Re: [Wtr-general] Unknown Method error in Watir 1.4

2005-08-23 Thread Bret Pettichord

This is fixed in 1.4.1

At 07:57 AM 8/23/2005, Angrez Singh wrote:



Hi,

I have downloaded Watir 1.4 and got the following error while trying to 
access 'to_s' method of 'P' element.


My script accesses the 'P' element using the 'id' attribute. The code 
looks like this:


  1. element = $ie.p(:id,pElement)
  2. puts element.type
  3. puts element.to_s

The exact error is:
P
d:/installations/ruby/lib/ruby/site_ruby/1.8/watir.rb:2211:in 
`span_div_string_creator': undefined method `style' for 
#Watir::P:0x2ac7f38 (NoMethodError)
from 
d:/installations/ruby/lib/ruby/site_ruby/1.8/watir.rb::in `to_s'

from testXpath.rb:10

The 'P' on first line is shown due to line no.2 of the code shown above 
but when I try to access 'to_s' method it gives an error.


I think there is a bug in the 'span_div_string_creator' method of 'class 
SpanDivCommon'


The code of this function looks like this in version 1.4:
  # this method is used to populate the properties in the to_s method
def span_div_string_creator
n = []
n   style:.ljust(TO_S_SIZE) + self.style
n   text:.ljust(TO_S_SIZE) + self.text
return n
end
private :span_div_string_creator

Now when we try to do 'self.style' an error is thrown because there is no 
property or method called 'style' for 'IHTMLParaElement' whose object we 
access in watir.


For more information:
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/ifaces/paraelement/paraelement.asp

This link from MSDN shows that 'IHTMLParaElement' has only one property 
called 'align'


Similarly while accessing 'SPAN' element I got the same error because 
'IHTMLSpanFlow' element also contains only 'align' property.


For more information:
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/ifaces/spanflow/spanflow.asp

This holds true from 'DIV' element also because 'IHTMLDivElement' contains 
properties 'noWrap' and 'align'

For more information:
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/ifaces/divelement/divelement.asp

Or am I missing something completely here?

Regards,
Angrez


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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] html() and outerhtml() methods

2005-08-23 Thread Bret Pettichord

I would call this a bug, actually.

At 10:33 AM 8/23/2005, Owen Rogers wrote:

just noticed that the html() and outerhtml() methods return
getDocument().body.outerHTML.  this returns only the html for the body
section, not for the entire page, which i'm inferring from the
comments, is the correct behaviour.
to get the html for the entire page, i've found that
getDocument().firstChild.outerHTML does the trick, though there might
be a better way to get the document root element.
cheers,
owen.
--
Owen Rogers | http://dotnetjunkies.com/weblog/exortech |
CruiseControl.NET - http://ccnet.thoughtworks.com

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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] WAIT statement didn't wait?

2005-08-23 Thread Bret Pettichord

Tx for the info.

Just so you know, this doesn't do what you think:
  ie.frame(main).frame(sidebar).wait(analysisSidebarTabContent)
It's actually the same as
  ie.frame(main).frame(sidebar).wait(true)

The fix regarding wait and attach is in 1.4., so this may be a new problem.

Bret

At 12:46 PM 8/23/2005, Tuyet Cong-Ton-Nu wrote:

OK, thanks, Bret for the suggestion. Per your request, here are some 
additional lines of code that preceded the while statement.


There is the attach statement which may be causing the problem since you 
had opened up a bug on that a couple of days ago?






ie.frame(:name, portfolioTreeContent).frame(:name, 
treeframe).link(:text, /MMIM/).click


sleep 3

ie = Watir::IE.attach(:url, 
https://test.com/araneae/app;)  #Reconnect back to main frame



ie.frame(main).frame(sidebar).wait(analysisSidebarTabContent)

sleep 3

while 
!ie.frame(main).frame(sidebar).frame(analysisSidebarTabContent).image(:src, 
/icon_report_positions.gif/).exists?


sleep 0.1

end


ie.frame(main).frame(sidebar).frame(analysisSidebarTabContent).image(:src, 
/icon_report_positions.gif/).click

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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Re: How to click a javascript alert button

2005-08-23 Thread Bret Pettichord

At 11:00 AM 8/23/2005, Torres, Ben (HQP) wrote:

How can I get to HEAD to download dialog_tests.rb?


http://rubyforge.org/scm/?group_id=104

Go here and browse the CVS repostory.

_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Question...

2005-08-24 Thread Bret Pettichord

At 11:21 AM 8/24/2005, Jeff Wood wrote:

darn, but, ok.


with time you will thank me.

_
 Bret Pettichord
 www.pettichord.com

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


[Wtr-general] Wet or Watir

2005-08-24 Thread Bret Pettichord

Have you looked at both WET and Watir and then chosen to use Watir? Why?

Why shouldn't we just be encouraging everyone to use WET?

This is a serious question. Is there anything that you can do with Watir 
that WET can't do?


Bret


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] [ wtr-Support Requests-2303 ] get the inner text from a pre tag

2005-08-24 Thread Bret Pettichord

Anyone want to help this guy out?

All you have to do is look at the code for P and Span and do the same thing 
to create a Pre.


It is a couple lines of Ruby.

Any takers?

Bret

At 06:50 PM 8/24/2005, [EMAIL PROTECTED] wrote:

Support Requests item #2303, was opened at 2005-08-24 19:50
You can respond by visiting:
http://rubyforge.org/tracker/?func=detailatid=488aid=2303group_id=104

Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: get the inner text from a pre tag

Initial Comment:
Im trying to get the text from inside a pre tag that is in a frame. this 
frame doesn't contain any other HTML but the pre tag and the text in 
between. like so...


pre
some text here...
some text here...
some text here...
some text here...
/pre


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] watir/dialog

2005-08-25 Thread Bret Pettichord

At 09:22 PM 8/24/2005, Jeff Wood wrote:

Do you have any examples using the new remote_eval stuff?


In the unit tests


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Undefined method getObject when attempting to do a set on a text field.

2005-08-29 Thread Bret Pettichord
I'm pretty sure than none of the Watir releases included the 'locate' 
method -- that is only in head.


When we created the 1.4.1 release, we were careful to only include minor 
fixes and updates that we were pretty sure would not break WET (for 1.4).


It may be worth noting that the regular installers (either the old 1.4 and 
earlier or the new 1.4.1 one-click installer) install watir into a 
different location than the gem. I do not know what happens if watir is 
installed both ways. I suspect that one would overrule the other, but i 
don't know which.


The best bet is to uninstall one version of Watir before installing a new 
version. Both of the installers for 1.4.1 have uninstall options. (Prior to 
that we didn't.)


Bret

At 10:45 AM 8/29/2005, Raghu Venkataramana wrote:

Hi Stephanie,

This is getting intersting. I just did a gem install of watir myself, but 
still

couldn't find the method 'locate' as shown by:

D:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3205:in `locate': undefined

However I got the latest version HEAD version from cvs
repository and that version _does_ have the locate method
that is giving you the trouble. I took a quick look at that code and 
unfortunately wet's current version wont work with that implementation. 
For the current version of WET you need to make sure that you use the 
version that got installed off from the gem and not the CVS version.
Your best bet may be to simply copy the Watir.rb from 
d:\ruby\lib\ruby\gems\1.8\gems\watir-1.4.1.rb to 
D:/ruby/lib/ruby/site_ruby/1.8/watir.rb

Thanks
Raghu





Stephanie Mayfield wrote:


Raghu,

I installed 1.4 originally then I overwrote that installation via the
gem.  The gem is listed as 1.4.1.
Thanks for looking into this!

Steph


On 8/29/05, Raghu Venkataramana [EMAIL PROTECTED] wrote:



Hi Stephanie,

Are you using a released version of Watir 1.4 or something off the SCM
repository?

I was trying to locate the source of the problem from your stack trace:

   from D:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1766:in `assert_exists'
   from D:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3368:in `set'

and in the version(s) of Watir1.4 that I have, I could not find neither
assert_exists method in line number 1766 nor 'set' method at 3368. If you
are using a version from the SCM could you tell me the exact revision number
so that I could check the same version out here and try it.

Thanks
Raghu




Stephanie Mayfield wrote:




I apologize in advance if this question has already been asked.  I'm
new to the list and the hunting and pecking in the archives didn't
turn up an answer.  (Aside: is there a search engine on the archives?)

My problem is I'm getting an error when attempting to do a very simple
assignment to a text field.

require 'WET'
include WET

ie=Browser.new()
ie.goto http://URL here
ie.show_all_objects

puts username object exists:  + ie.TextField(name:=username).to_s
ie.TextField(name:=username).set('first.last')


My output confirms that the username field does in fact exist on the page:

username object exists: WebEdit(name:=username)

But then I get this exception:


D:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3205:in `locate': undefined
method `getObject' for nil:NilClass (NoMethodError)
 from D:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1766:in `assert_exists'
 from D:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3368:in `set'
 from 
D:/ruby/lib/ruby/site_ruby/1.8/qantom/webobjects/WebEdit.rb:59:in `set'

 from D:/ruby/myRuby/AdminTest/simple.rb:9

I'm not sure if this is a WET issue or a Watir issue.  What I'm running 
on is:

-  Win XP
-  Watir v1.4
-  WET v0.5.1 (for water v1.4, doesn't include the optional component)

Watir by itself access the website just fine, however I have
JavaScript pop-ups so I'm attempting to use WET to access those.

The URL and username do not contain any extended characters.

Assistance is greatly appreciated!





--
Qantom Software

http://www.qantom.com
Ph : 26799269 Xtn. 125
sip : [EMAIL PROTECTED]
--

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









--
Qantom Software

http://www.qantom.com
Ph : 26799269 Xtn. 125
sip : [EMAIL PROTECTED]
--

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


_
 Bret Pettichord
 www.pettichord.com

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


[Wtr-general] Re: [ wtr-Feature Requests-1371 ] methods for visible/hidden

2005-08-29 Thread Bret Pettichord

Ron made this helpful comment to a recent feature request:


Comment By: Ron Evans (greatbignoise)
Date: 2005-08-26 19:19

Message:
Try adding this code to the ObjectActions class:

# This method checks to see if a control is visible or not
#   raises: UnknownObjectException  if the object is not found
def visible?
object_exist_check
return false if @o.style.visibility == hidden
return true
end


You can then use an assert like the following:
assert(@ie.text_field(:id, Text2).visible?)


I just wanted to point out that one of the great things about Ruby is that 
you can implement suggestions like this without actually changing watir.rb. 
Thus:


  class ObjectActions
def visible?
object_exist_check
return false if @o.style.visibility == hidden
return true
end
  end


You can load this code and add the feature right away. You don't have to 
patch watir.rb or wait for us to include it in a release. (If you look in 
watir.rb, you'll see that we actually add methods to the String and Regexp 
classes ourselves.)


This is one of the few features of Ruby that put it way ahead of what you 
can do in Python. The technical description of this feature is 'classes are 
always open.' (Actually you *can* freeze classes in Ruby, but i've never 
seen it done.)


(Also note that the ObjectActions class was renamed as Elements in 1.4)

Bret


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] unittest failures in head

2005-08-29 Thread Bret Pettichord

At 09:38 PM 8/26/2005, Paul Rogers wrote:
The first time I ran ( all_tests.rb), somethig went wrong about the time 
the screen capture tests ran - IE closed and every test after that failed.


This also happens to me.


Second time I got this:

  1) Error:
test_table_from_element(TC_Tables):
NoMethodError: undefined method `parentElement' for nil:NilClass
c:/watir_cvs/watir/unittests/../watir.rb:2290:in `create_from_element'
c:/watir_cvs/watir/unittests/../unittests/table_test.rb:175:in 
`test_table_from_element'


192 tests, 1081 assertions, 0 failures, 1 errors


Fixed in head.



_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Help : new to Watir

2005-08-29 Thread Bret Pettichord
You can run watir with the -b switch to make it faster. We are also working 
on other methods to improve performance.


But 200 sessions is a lot for watir. Most boxes cannot support that many 
instances of IE, whether you are using watir or just creating IE sessions 
manually.


So i agree with Jeff.

At 03:14 PM 8/26/2005, Jeff Wood wrote:

It sounds like you are doing load testing which is not what I think
WATiR is intended for.

WATiR is meant for functional/procedural testing.

If you are simply wanting to load/perf-test large quantities of
simultaneous sessions on the system ... That would possibly be better
suited for simple HTTP calls directly... ( like using uri-open or wget
and/or curl )

That's my $0.02 ... YMMV

j.

On 8/26/05, Murtaza Lokhandwala [EMAIL PROTECTED] wrote:
 Hi Everybody,

 I started using WATIR to write my first web
 application test script two ago.

 -- The web page I am testing has approximately 6 input
 boxes and 7 drop down boxes for each record. And I am
 displaying 10 records per page. To view more user have
 to use 'Next ' or ' Previous' buttons.

 I started with hard coded values to have a feel of
 WATIR. The script is working but I was planning to use
 it to load the web server / database by creating 200
 sessions. And each session creating 1 form having
 approx 50 transactions.

 Using the script I created couple of forms but each
 form is taking approximately 12-14 min for 20
 transactions.

 I am attaching the script for the review. Please help
 me me in making the script more efficient. Because the
 test case I am handling needs 200 such sessions.

 Thank you very much.

 Murtaza



 __
 Yahoo! Mail for Mobile
 Take Yahoo! Mail with you! Check email on your mobile phone.
 http://mobile.yahoo.com/learn/mail

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






--
So long, and thanks for all the fish

Jeff Wood

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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Any intellisense IDE for Ruby? Also WatirMaker rocks..

2005-08-29 Thread Bret Pettichord

At 12:12 AM 8/25/2005, saud aziz wrote:
For now i want to know if there is any IDE for Ruby that provides 
intellisense? Ecllipse plug-in maybe anyone...?


No.


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Problem with running tests in a suite

2005-08-30 Thread Bret Pettichord

For IE Controller:

http://rubyforge.org/frs/shownotes.php?release_id=241

* Added fix for the RPC intermittent bug that would occur of an instance
  of ie/iec was created too soon after a previous one was killed.

Code change to def initialize():

# creating a new IE instance immediately after quiting a previous one
# causes intermittent RPC unavailable errors and other weirdness.
# Make sure to wait 1 second after eating before swimming...
until (Time.now - @@closed_last)  1; sleep 0.1; end if @@closed_last

immediate preceeds:

@ie = WIN32OLE.new('InternetExplorer.Application')

Any reason we shouldn't add this code to Watir?

-

I remember complaining about this problem to Chris Morris when i was just a 
user of his IE Controller. I think he fixed it. Someone want to check the 
history of that project. Chris?


Maybe the answer is to avoid shutting down the COM server until you are 
done running tests.


One way would be to reuse the same client with your tests. That is what we 
do with the Watir unit tests. Another would be create an invisible ie at 
the beginning and not shut it down in the end. If we have one client 
reference, closing other ie instances won't also shutdown the server.


Bret



_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] assert PASSED and FAILED

2005-08-30 Thread Bret Pettichord

You shouldn't use assert in this situation. Instead:

if $ie.contains_text(TestGroup)
$logger.log(test_CreateGroupTest-TestGroup Found-TestGroup 
Found-PASSED)
$logger.log_results(test_CreateGroupTest, TestGroup Found, 
TestGroup Found, PASSED)

else
puts(TEST FAILED. + e.message + \n + e.backtrace.join(\n))
$logger.log_results(test_CreateGroupTest, TestGroup Found, 
TestGroup NOT Found, FAILED)

end


At 09:09 AM 8/30/2005, Ian Phillips wrote:

Hi.

I have the following assert below.  When this code is executed I get both 
PASSED and FAILED messages reported??


begin
assert($ie.contains_text(TestGroup))
$logger.log(test_CreateGroupTest-TestGroup Found-TestGroup 
Found-PASSED)
$logger.log_results(test_CreateGroupTest, TestGroup Found, 
TestGroup Found, PASSED)

rescue =e
puts(TEST FAILED. + e.message + \n + e.backtrace.join(\n))
$logger.log_results(test_CreateGroupTest, TestGroup Found, 
TestGroup NOT Found, FAILED)

end


This is the output


log test_CreateGroupTest-TestGroup Found-TestGroup Found-PASSED
log XML file output: Test case: test_CreateGroupTest input: TestGroup 
Found expe

cted: TestGroup Found status: PASSED
TEST FAILED.closed stream
./example_logger1.rb:62:in `write'
./example_logger1.rb:62:in `puts'
./example_logger1.rb:62:in `log_results'
./CreateNewGroup_tst.rb:70:in `test_CreateGroupTest'
c:/ruby/lib/ruby/1.8/test/unit/testcase.rb:70:in `__send__'
c:/ruby/lib/ruby/1.8/test/unit/testcase.rb:70:in `run'
c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:32:in `run'
c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:31:in `each'
c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:31:in `run'
c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:32:in `run'
c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:31:in `each'
c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:31:in `run'
c:/ruby/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:44:in `run_suite'
c:/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:65:in `start_mediator'
c:/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:39:in `start'
c:/ruby/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:27:in `run'
c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:194:in `run'
c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:14:in `run'
c:/ruby/lib/ruby/1.8/test/unit.rb:285
c:/ruby/lib/ruby/1.8/test/unit.rb:283
log XML file output: Test case: test_CreateGroupTest input: TestGroup 
Found expe

cted: TestGroup NOT Found status: FAILED


I was assuming I would get one or the other?

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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] Re: Wtr-general Digest, Vol 21, Issue 87

2005-08-30 Thread Bret Pettichord
ie won't work. that is a local variable. $ie is global and will be valid in 
all locations.


Bret

At 10:54 AM 8/30/2005, you wrote:





Thanks for your responses!

This code is a modified version of the code in textfields_test.rb, so I
believe the syntax is accurate.  I changed Test1 to test1, which provides
the same result.  I also removed the $ from the ie and I get this

Loaded suite C:/Apps/PowerSeller Test Scripts/carl_textfields_test
Started
Set URL variable
Start New Browser
Setup: go to the test site: http://www.yahoo.com
Assertion Test in Position B
E
Finished in 1.082 seconds.

  1) Error:
test1(TC_Fields):
NameError: undefined local variable or method `ie' for
#TC_Fields:0x2b7fb48
C:/Apps/PowerSeller Test Scripts/carl_textfields_test.rb:33:in `test1'

1 tests, 0 assertions, 0 failures, 1 errors

My gut is telling me it is something with my development environment.  If
someone has a moment please copy and execute this script in your
environment.

Thanks,

Carl

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


_
 Bret Pettichord
 www.pettichord.com

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


[Wtr-general] New installer -- I have a reproducible case of the error

2005-08-30 Thread Bret Pettichord

I think i've got it. Really.

When you click on the one-click installer (watir-1.4.1.exe) IE gives you a 
choice:

1. Open
2. Save

If you choose Open, the install will fail and the installer directory will 
be blank and you will get an error about \watir\AutoIt.chm.


If you choose Save and then install it from there, it will install correctly.

Bret

_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] WAIT statement didn't wait?

2005-08-30 Thread Bret Pettichord

Actually, ie.wait(true) would do the same thing.

Here is the code for Frame#wait:

def wait(no_sleep = false)
@container.wait(no_sleep)
end

It simply passes the wait call up to the container of the frame (the ie 
object).


What wait does is wait for the page to finish loading; it automatically 
checks sub frames. It sounds like what you want to do is wait until a 
particular object exists. We don't have anything like that in Watir.


Bret

At 07:12 PM 8/26/2005, Tuyet Cong-Ton-Nu wrote:


Just so you know, this doesn't do what you think:

   ie.frame(main).frame(sidebar).wait(analysisSidebarTabContent)

It's actually the same as

   ie.frame(main).frame(sidebar).wait(true)




Hmm!  So the statement I used is actually is checking to see if the 
sidebar is there and NOT the analysisSideBarTabContent ?




Should I use this then for the analysisSideBarTabContent?

ie.frame(main).frame(sidebar).frame(analysisSidebarTabContent).wait(true)

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


_
 Bret Pettichord
 www.pettichord.com

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


Re: [Wtr-general] browse option

2005-08-31 Thread Bret Pettichord

look at filefield_test.rb

At 12:24 AM 8/31/2005, Nishita Acharya wrote:

hello,
 i have a browse option in one of the forms.I have automated it to 
pop the 'choose file'  window.but i have to choose a file and open it 
manually.Can this be automated? The view source contains this


form action=UploadScript_mail.asp method=POST 
enctype=multipart/form-data

  input type=FILE size=50 name=Attachment/form

any hints?


Regards,

Nishita Acharya
Bangalore.


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


_
 Bret Pettichord
 www.pettichord.com

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


  1   2   3   4   5   6   7   8   9   10   >