[Wtr-general] Modal_dialog, hangs on second use.

2006-10-13 Thread John Lolis
Started using watir a couple of days ago (love it), but I'm stuck on these 
modal dialogs. I'm using "watir-1.5.1.1100". It appears the second use of a 
modal dialog causes the script to hang.

Any help would be great! This is my only sticking point so far. I read that you 
should use "click_no_wait" but i'm using document.all[stuff].click and it 
doesn't seem to support that. Thanks for any help.

Here is what I'm doing

1. Open the modal dialog (this works fine)

@@browser.frame( :name, frameName ).document.all[ action1 ].click

2. Use the dialog (this works fine too)

modal1 = @@browser.modal_dialog
modal1.text_field( :name, filedName ).set( inputText )
modal1.document.all[ action_save ].click

3. Open the next dialog (works fine)

@@browser.frame( :name, frameName ).document.all[ action2 ].click

4. Use the dialog (this DOESN'T work)

@@browser.modal_dialog.document.all[ actionConfirm ].flash
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4778&messageID=13199#13199
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Modal Dialog and checkbox

2006-10-20 Thread John Lolis
unable to located object in general means that the page has not yet load (as 
far as I understand it. Instead of sleep (which just slows down everything) try 
wrapping your code as follows. (The below is just an example, and only my 
opinion. I'm sure there are 1000 better ways of doing this) :)

#Lets call our special function with your ID details
modalCheck(inpCheckBoxDC_19)
modalCheck(inpCheckBoxDC_23)
modalCheck(inpCheckBoxDC_20)
modalCheck(inpCheckBoxDC_1)
modalCheck(inpCheckBoxDC_12)

#In here, instead of sleeping, lets try to set it. If that fails
#Lets wait 1 second then try again, if that fails lets wait
#10 seconds and try again
def modalCheck (id)
retryShort = true
retryLong = true

begin
ie.modal_dialog.checkbox( :id, id ).set
rescue
if retryA
sleep(1)
retryShort = false
retry
end
if retryB
sleep(10)
retryLong = false
else
raise
end
end
end
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4874&messageID=13542#13542
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Modal Dialog and checkbox

2006-10-20 Thread John Lolis
Timing issues are by far my biggest headache too.

I did see a patch (never tried it) that would handle recursive frame waits (or 
something like that). Not sure if that would handle modal issues.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4874&messageID=13558#13558
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Handling multiple versions of a website [advice needed]

2006-10-24 Thread John Lolis
Looking for some feed back on this topic.

To start, I'm attempting to automate a very large and very complex web 
application. Watir is great at handling all the strange controls (it has some 
timing issues with frames and modal dialogs, but those are known issues). The 
problem I now face is how to keep my tests from become outdated in a fast 
moving environment.

Its simple enough to wrap Watir calls in objects (for example a "Login" 
object") so that I can write a test case and use "Login(name,pass)" instead of 
"ie.link(yadayada).click". The problem comes when you have 20+ objects 
currently (and it will probably grow 10 fold) and all of them contain Watir 
code. When a new version of the web site comes out I predict tracking down the 
problems (and adding switches to handle old versions) would quickly make the 
project unmaintainable.

Has anyone thought of a good way of managing such changes? Do you make one 
giant 'mapping' class and just update that as needed? Do you store the Watir 
calls and generate code around them? 

Any insight from someone who has been through this would be great :)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4936&messageID=13707#13707
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Handling multiple versions of a website [advice needed]

2006-10-25 Thread John Lolis
Thanks for the input davemunns, its nice to hear from someone who is so far 
along in a project.

My only real fear is that of maintaining such a giant library. If you were to 
leave your company tomorrow, would someone be able to pick it up in time before 
it got too out of date?

I typed a lot more, but it was me rambling. :)

I'll post more thoughts on the subject once my coffee gets in me. Thanks for 
the input!
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4936&messageID=13745#13745
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Handling multiple versions of a website [advice

2006-10-25 Thread John Lolis
Great advice so far, and thank you for the link to the article.

The idea of testing the testing framework is very interesting! I guess it would 
be really straight forward to write a basic test that jumps into the framework, 
and just does a very basic probe making sure no exception gets thrown. 

This would also avoid the problem of a method in a class getting 'stale'. For 
example if I write a class today and the test that uses it is removed from 
rotation (for whatever reason). The 'tester' script would inform me when it 
breaks (as opposed to a tester writing a script only to find the desired class 
broken).

Thanks again, and I welcome any more ideas people have. I've been reading every 
article I can get my hands on and it seems to be helping me avoid the standard 
pitfalls (I hope).
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4936&messageID=13768#13768
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] "Breakpoint" great tool to use with Watir

2006-10-30 Thread John Lolis
Just thought I would share this. I found this interesting program called 
"breakpoint"

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

this allows you to add "breakpoint()" anywhere in your program and the IRB pops 
up. You can then poke around and debug issues. This has been a HUGE help to me. 
It allows me to test out some logic on the fly, or figure out whats going wrong.

Hope it helps others.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5024&messageID=13982#13982
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Recover from IE crash?

2006-11-02 Thread John Lolis
I seem to have found a way of crashing IE during my testing (something I do 
makes it happen, though I have never done it in a manual way).

Is there a way to recover from this? (IE, can I close the dialog that asks me 
to debug it?)

Message was edited by: 
jlolis
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5069&messageID=14104#14104
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Hacking Ruby

2006-11-03 Thread John Lolis
very cool!

I have been wondering how to do something like this, and it makes so much sense 
now.

thanks!
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5072&messageID=14118#14118
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Recover from IE crash?

2006-11-06 Thread John Lolis
Thanks for the input. I was seeing the crash as a problem to get around, as 
opposed to a problem to investigate :)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5069&messageID=14195#14195
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] QuickTest Pro vs Watir?

2006-11-06 Thread John Lolis
Looking for some experience from people that have used both. We are currently 
looking into both of these applications, and I'm wondering if anyone has any 
experience (that they care to share on the subject).

Cost alone isn't that big of an issue. So its a point that doesn't need to be 
stressed.

I'm finding with QTP (quicktest pro) once you move out of the basic recorder 
(which is fine for laying out some ground work) and enter 'expert mode' you are 
more or less dealing with things the same way as Watir.

Thanks in advance!
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5110&messageID=14197#14197
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] QuickTest Pro vs Watir?

2006-11-07 Thread John Lolis
Thanks for the great input. I have a more specific question though. How is the 
support of (well written) QTP steps down the road?

Watir/Ruby scripts (if well designed) seem to be very easy to support. Is that 
also the case with QTP?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5110&messageID=14241#14241
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] click_no_wait (again)

2006-11-07 Thread John Lolis
Post the code you are using that causes this, that might help :)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5137&messageID=14254#14254
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Watir tests as how-to documents

2006-11-08 Thread John Lolis
I do this to a degree, but I consider it to be logging not documentation.

I have 3 levels of logging (there are more, but thats besides the point)

Section, Test and Details

A section would be like "Administration" a test would "Create a New User" and 
details are "Clicked 'new user', 'Set user name 'Sam' '.

When my program runs the output is in excel, and the different types are color 
coded. The 'details' are normally filtered out, its way too much information.

[11:30am] - Administration (this is yellow background)
[11:30am] - click new user (this is grey background)
[11:30am] - set user name 'sam' (this is grey background)
[11:31am] - Login PASS (or if something went wrong, login FAIL, or if it 
exploded UNKNOWN ERROR) (this is white background)

Personally I do not want to generate a test document from my script. My script 
should be born from a document. Thats me though, it all depends on the 
situation.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5156&messageID=14301#14301
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] detecting an item in drop down list

2006-11-09 Thread John Lolis
As with everything i type, I'm sure its not the best of way of doing it. Heres 
a quick way of getting it working until someone comes along and helps.

select_list = $ie.select_list( :name , 'yourSelectListHere').

select_list.text.include? 'What you want to find'

Message was edited by: 
jlolis
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5184&messageID=14390#14390
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] WIN32OLERuntimeError - I get this error after two

2006-11-09 Thread John Lolis
So if I'm reading this right you are saying you have collected 2670 links, but 
are exploring link 129 and the browser closes?  The exploring is just a goto 
'address' I assume. If my assumptions are correct, heres a couple questions.

Questions,
If you attempt to go straight to that link (hard code some data into your loop 
to force it to go straight there) does it happen?

If you slip in a link before 129, which one does it crash on?

Have you tried turning off taking screen shots, then see where it happens?

If you attempt to 'goto' the link by hand, does the browser close?

Hope a question stirs something in your head to get you back on the right track 
:)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5183&messageID=14395#14395
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Find parent table index from a specific element within

2006-11-15 Thread John Lolis
Lets say we have the following

Table
.TR
..TD
..TD
...SPAN text=findme
..TD
...Text Input Field

The only element in this entire section that I can identify uniquely is the 
span. The span happens to be located within a table. That table also contains 
the text input field (my real goal). So is there a way to find out what the 
table index is that contains a span? To explain it another way, here is some 
fake code.

table_index = $ie.frame('frame1').span(:text,'findme').get_parent_table_index()
$ie.frame('frame1').table(:index,table_index)[1][3].text_field(:index, 
1).set('i did it!')
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5270&messageID=14638#14638
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Find parent table index from a specific element within

2006-11-15 Thread John Lolis
That is actually a really nice simple solution, I have no idea why I didn't 
think of it. I decided to go with a simple parser. It looks for a certain 
table, finds a sub stable by index, finds the length then attempts to locate 
input fields within it.

Thank you though, you got my brain thinking in a different direction.

I'm still holding out hope that their is a way to find containing elements.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5270&messageID=14678#14678
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Can't Determine The Error...

2006-11-28 Thread John Lolis
I assume this is the standard 'access is denied' error.

http://wiki.openqa.org/display/WTR/FAQ

Look for the 'access is denied' section, it should help.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5476&messageID=15274#15274
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] how to tell when IE is *really* done

2006-11-28 Thread John Lolis
maybe a silly question, how do we apply the above patch?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5487&messageID=15295#15295
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Excel Or Text File?

2006-12-05 Thread John Lolis
If these are just a couple of simple constants why not make it a ruby file? 
require a file somewhere in your scripts and do something like

$name = 'name'
$password = 'password'
$url = 'url'

its easy to figure out, and no need to parse anything.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5619&messageID=15692#15692
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] How does one access a web page element by its css class?

2006-12-07 Thread John Lolis
While I can't answer the exact question, I can explain how I would solve it.

Find the 'nearest' containing element that you can use (a table, div, span - 
whatever). Then use that element AND the index of the image. This helps you 
narrow it down.

So say you had

Table :id 'table_one'
row
row
.image (this is the image you wanted)
row


Then you could do

$ie.table(:index, 'table_one')[3][1].image(:index, 1)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5661&messageID=15810#15810
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Warnings: already initialized constant when executing watir scripts

2006-12-07 Thread John Lolis
shot in the dark here, did you by chance "require 'Watir'" twice?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5662&messageID=15816#15816
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Warnings: already initialized constant when executing watir scripts

2006-12-07 Thread John Lolis
just for fun i opened up the irb and did the following

irb: require 'Watir'

and that happend. I wouldn't worry about it :)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5662&messageID=15830#15830
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Wait functionality in Watir ..need help

2006-12-20 Thread John Lolis
You have the right idea, wanting to wait until the bar is done, but you are 
approaching it slightly wrong. I would first try to understand why *you* know 
the progress bar is done. Is it because the bar gets to the end and its full? 
Is it because something says 'complete'? How do you know it failed?

Once you gathered these answers you will probably find you are waiting for a 
certain event to occur. This event doesn't always happen X seconds after you 
click something, it happens when its done (it also will probably fail at some 
point).

So to start, we need to find that 'anchor' in the future. This is some page 
element that lets the user know that its done. Lets pretend this is an image. 
So we want to wait at most, lets say, 20 seconds (this depends on your app) or 
until some image exists.

I'm going to give you some code I'm just thinking up, this should be used to 
help illustrate my idea and maybe inspire a solution from you. I'm sure you 
will think up something much better on your own.

# Note the below code should not be used, its just an idea of how you might do 
this

wait_max = 20
wait_increment = .1
wait = 0

while wait < wait_max
.if ie.image(*whatever*).exists? #this is the event, it could be anything
..# Found it, do the next part
.else
..wait += wait_increment
end
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5861&messageID=16400#16400
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] CRITICAL---Clicking Image Button in Application

2006-12-20 Thread John Lolis
have you tried .fire_event('onClick')?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5868&messageID=16411#16411
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Syntax for relative attributes

2006-12-20 Thread John Lolis
headline = $ie.div(:text, 'Pragmatic Version Control')
link = $ie.link(:class => 'addtocart', :after? => headline) 

Is this saying you want the link that comes after headline? Is there a before? 
:)

*if* thats the case, my only problem with it is that it seems to not follow the 
standard syntax of Watir (as i understand it).

how about ie.link(:class,'addtocard').after(ie.div(:text,'Pragmatic Version 
Control'))
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5849&messageID=16433#16433
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] How to capture exception details

2006-12-21 Thread John Lolis
see: http://www.rubycentral.com/book/tut_exceptions.html

this might be enough brain food to get you started. Just need to throw in some 
control loop (an array of tests maybe?), specific error handling and maybe even 
retries.

begin
-#Do your thing
rescue
-#put the error data into something nice
-error = $!.to_s
-stack = $@
# spit it out
-puts 'Error ' + error
-stack.each {|x|puts 'Stack Trace: ' + x}
end
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5886&messageID=16478#16478
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Syntax for relative attributes

2006-12-21 Thread John Lolis
> link = ie.div(:text, 'Pragmatic Version
>  Control').after.link(:class, 
> addtocard')
> 
> 
> I think this is less intuitive and it would be
> somewhat harder to 
> implement. That's why i came up with the other
> proposal, above.

Thats actually the first way I thought of it too.

A second, slightly related question. Regardless of how you do it, i'm wondering 
whats going on behind the scenes.

If you do 

> headline = $ie.div(:text, 'Pragmatic Version Control')
> link = $ie.link(:class => 'addtocart', :after? => headline) 

Is headline now 'frozen'? For example, lets say there is a 'addtocart' after 
headline. What happens if after you create your headline variable the page 
changes (headline is now at the bottom of the page)? Will the after method re 
evaluate headlines position in the page? Or is headline now static so after 
would would be true even if it isn't?

I'm not sure if that even made sense.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5849&messageID=16487#16487
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] What are people using for 'test executive'?

2007-01-05 Thread John Lolis
> Otherwise a group I'm associated with is beginning to
> write an open source enterprise Ruby Rails interface
> for launching Watir scripts remotely but we've only
> begun and it may take up to a year before we have
> anything solid.

I think as Watir becomes more mature and accepted tools like this will be so 
very important.

Personally I went the roll your own method, though if there was an open source 
base to build off I would have used that in a second. If i ever get some free 
time I'm going to attempt to write a custom harness for google.com. I think a 
working end to end custom harness would be a great way to get discussion going 
on a number of subjects.

now I'm just rambling! Good luck on that project :)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6009&messageID=16862#16862
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Menu links have duplicate attributes

2007-01-08 Thread John Lolis
Are either of the "Edit News" links contained within another element (table?). 
You may be able to do something like

ie.frame('whatever').table(:id,'table1').link(:title,'Edit News')

and

ie.frame('whatever').table(:id,'table2').link(:title,'Edit News')

like the other poster said though, a hard index isn't going to be the end of 
the world if nothing else works. You could also approach the developer and ask 
for a tag that would work better for you, its always an option.

Good luck.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6036&messageID=16911#16911
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Syntax for relative attributes

2007-01-09 Thread John Lolis
I think what bret said is

$my_button = $ie.button(:id, 'foo')

is a bad idea. It may be better to do something like...

def my_button()
return( $ie.button(:id, 'foo') )
end

while

my_string = $ie.text

could be fine, though you  could still do

def my_string()
return( $ie.text )
end

... i think

The concept being you want to, depending on your situation, write a script that 
uses some sort of abstraction layer. This means your 'high level' scripts will 
not need to be changed much at all (I'm doing this, and it works wonders), 
while your abstraction layer will change with the site.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6038&messageID=16960#16960
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] hi , few quries with WATIR

2007-01-09 Thread John Lolis
for editors I use Mondrian. Its very simple, but works great.

Try out a bunch of them, find one that works for you.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6048&messageID=16961#16961
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Wtr-general Digest, Vol 38, Issue 14

2007-01-09 Thread John Lolis
I just ran into same problem myself i think. I am running 1.8.4. Going to 
switch to 1.8.2 tomorrow and see if that fixes it.

The AutoIt dll must be correctly registered for this feature to work properly
C:/Program 

Files/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1127/./watir/windowhelper.rb:42:in
 `check_autoit_installed'

C:/Program 
Files/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1127/./watir.rb:3956:in `set'
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6057&messageID=16969#16969
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Error with file_field in a modal window (using 1.8.2 / 1.5.1.1127 )

2007-01-10 Thread John Lolis
Having some problems using file_field in a modal window. Like the subject says 
i do have 1.8.2 installed (just installed it) and Watir 1.5.1.1127 (from the 
gem) and I'm getting the following error.

The AutoIt dll must be correctly registered for this feature to work properly
c:/program 
files/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1127/./watir/windowhelper.rb:42:in
 `check_autoit_installed'
c:/program 
files/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1127/./watir.rb:3956:in `set'

here is the HTML of the field itself



anyone have any ideas :)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6074&messageID=16999#16999
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Error with file_field in a modal window (using

2007-01-10 Thread John Lolis
Thanks for the information!

I registered AutoItX3.dll using regsvr32 and it got rid of the error message, 
the problem now is it doesn't fill in the field with any text. I can flash it, 
so i know I have the right field - I just can't put anything in there.

any more ideas?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6074&messageID=17003#17003
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] OT: Need help Trapping Errors in Ruby

2007-01-10 Thread John Lolis
> ## Main script snippet:
>   ...
> # open the IE browser
>   $ie = IE.new
> # A) Walk the Public Pages.  => Need to Trap this so
>  the
> something_went_wrong" variable works correctly
>   page_set_to_check( walk_Public_Pages )
> ---
> 
> # Here's the page_set_to_check() method:
> 
> module site_walkabout_methods
> 
>   def page_set_to_check( page_set )
> begin
>   page_set
> rescue => e
>   $something_went_wrong = 'Yes'
>   write_status
> 
> end

I'm a touch confused by this, what is page_set?

My first reaction is to say that somewhere deeper down in your code an 
exception is begin thrown and is silently beginning handled thus said function 
returns even though things didn't work.

The only reason I'm guessing this is because of the way you handle this 
exception.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6079&messageID=17017#17017
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Error with file_field in a modal window (using

2007-01-11 Thread John Lolis
Thanks Bret!

Everything is working perfect now. (who do i send the beer to?)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6074&messageID=17052#17052
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] modal_dialog not working in 1.5.1.1136, ruby 1.8.4

2007-01-15 Thread John Lolis
I seem to be having some issues attaching to modal_dialogs. I tried to register 
my win32ole but it didn't seem to help. (the dialog popped up and said it 
didn't appear to be a valid dll)

Heres my session in the IRB. Not after I hit 'new' I manually navigated and 
opened a modal dialog. Do I need to update to a new version or ruby?

irb(main):001:0> require 'watir'
=> true
irb(main):003:0> include Watir
=> Object
irb(main):004:0> ie = IE.new()
*snipped out*
irb(main):005:0> ie.modal_dialog
NoMethodError: IE#modal_dialog not supported with the current version of Ruby 
(1.8.4).
See http://jira.openqa.org/browse/WTR-2 for details.
undefined method `connect_unknown' for WIN32OLE:Class
from C:/Program 
Files/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1136/./watir.rb:2703:in 
`initialize'
from C:/Program 
Files/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1136/./watir.rb:450:in 
`modal_dialog'
from (irb):5
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6110&messageID=17136#17136
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] modal_dialog not working in 1.5.1.1136, ruby 1.8.4

2007-01-15 Thread John Lolis
thanks zeljko,

I am logged in as an admin. I tried to register win32ole.so (which i have no 
idea what kind of file it is). Is there a win32ole.dll somewhere I should try?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6110&messageID=17142#17142
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] modal_dialog not working in 1.5.1.1136, ruby 1.8.4

2007-01-15 Thread John Lolis
Thanks!

I guess I should just read the error message more carefully next time :)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6110&messageID=17153#17153
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] modal_dialog not working in 1.5.1.1136, ruby 1.8.4

2007-01-16 Thread John Lolis
Adding to what Zeljko said,

Is there a way for Watir when its first load to check your version or ruby, if 
AutoIt is loaded and if things aren't as they should be spit out a warning?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6110&messageID=17196#17196
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] FireWatir version 1.0.1 released

2007-01-17 Thread John Lolis
great to hear!

I'm going to give this a shot today.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6147&messageID=17246#17246
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] how to use the commands present in the 'SimpIe' class?

2007-01-18 Thread John Lolis
not sure on your exact question but would

ie.link(:text,'Images').click

work?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6165&messageID=17314#17314
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Watir with Ajax

2007-01-18 Thread John Lolis
It may help if you include a snip of your code and html. I haven't had any 
problems using any 'ajax' items.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6170&messageID=17315#17315
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] undefined method `[]' for

2007-01-24 Thread John Lolis
> Another way to say this is:
> 
>   t.each {|x| puts x[0]}

I'm enjoying this thread, heres another way. Sans "0"!

for element in (t.index(t.first)..t.index(t.last))
puts t[element].first
end
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6230&messageID=17595#17595
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] How to access a table present within a form?

2007-01-25 Thread John Lolis
> result = ie.frame('builderFrame')  > ,  < 
> form(:name,'dummy').table(:index,1)[1][1].text 

well if that comma is in the actual code i don't think its going to work :)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6277&messageID=17656#17656
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] BUG: Using XPath

2007-01-25 Thread John Lolis
thanks for the link Zeljko, always wondered how patches worked.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6275&messageID=17660#17660
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Why does Watir sometimes not open an IE window, yet continues to run te

2007-01-26 Thread John Lolis
I have never seen this happen. Are you using "-b  (background)   Run Internet 
Explorer invisible" when you run the program? Is IE just minimized by chance? 
What version of IE are running? Is this a multi desktop setup (is it off the 
screen?)

Just some ideas :)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6286&messageID=17694#17694
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Unable to access a modal dialog box to select a particular value from i

2007-01-31 Thread John Lolis
Good question, heres my trick.

Download a product called spysmith (its linked in the wiki, but i'm sure google 
can find it).

After you install this spysmith allows you to see HTML values of any web page 
(including modal). The real trick though is that it allows you to see ALL the 
HTML. So what I do is get all the HTML, save it to a file on my desktop and 
open it. I'm then able to use the IE dev bar (or connect using the IRB 
show_all_objects etc) because its now just a normal web page.

Hope that helps.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6357&messageID=17931#17931
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Unable to access a modal dialog box to select a

2007-01-31 Thread John Lolis
> Another option is to use this script:
> 
> puts $ie.modal_dialog.html

... something about a forest and trees comes to mind ...

Thanks for such a simple solution :)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6357&messageID=17963#17963
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Is there a way to over ride Watir's checking if IE is busy?

2007-02-01 Thread John Lolis
Yes, i think this should work. I have never tried this and I can assure you 
that it will break way more things then it could ever fix :)

module Watir
class IE
def wait
puts 'hello'
end
end
end
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6392&messageID=18044#18044
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Unable to access a modal dialog box to select a

2007-02-02 Thread John Lolis
My best guess is that your modal dialog is using frames. The HTML that its 
returning is not the right frame.

Thats my best guess and how i would approach the problem.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6357&messageID=18076#18076
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] hypertext is present ?

2007-02-06 Thread John Lolis
ie.link(:text, 'Consultation des AS').exists?

is that what you are looking for?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6436&messageID=18223#18223
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] How do I connect to MS SQL 2005 using Ruby?

2007-02-06 Thread John Lolis
Google spit this out

http://wiki.rubyonrails.com/rails/pages/HowtoConnectToMicrosoftSQLServer

never tried it, but it might help :)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6445&messageID=18254#18254
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] WIN32OLERuntimeError

2007-02-07 Thread John Lolis
Post your code, I'm willing to bet that you are doing something out of order.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6466&messageID=18316#18316
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Identifying "Last" object using Index: -1 ???

2007-02-07 Thread John Lolis
Another option is to locate it within the table.

ie.table(:what, ever).button(:index,number)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6471&messageID=18335#18335
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] renaming sheets in Excel

2007-02-07 Thread John Lolis
Heres a link i found useful when i was going using Excel

http://wiki.rubygarden.org/Ruby/page/show/ScriptingExcel
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6472&messageID=18341#18341
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] url for link

2007-02-08 Thread John Lolis
you missed typed it, type it exactly

ie.link(:html, /ajax_add_term\/133/).click

I think the \ / is allowing the forward slash to be used as a string and not as 
a special regex character.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6325&messageID=18390#18390
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] How do I connect to MS SQL 2005 using Ruby?

2007-02-08 Thread John Lolis
to add to that, you could do something like writing out to a text file thats 
just a bunch of insert statements... FUN!

hrm, so many ideas now.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6445&messageID=18404#18404
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] How do I connect to MS SQL 2005 using Ruby?

2007-02-08 Thread John Lolis
heres my question to you.

You want SQL to store your results, but you are having some issues with using 
MSSQL. This tells me in the future you will continue to have issues. Why not 
think around the problem? Export into a format that can be imported into MSSQL 
(there are a ton of formats and it works great).

Doing this would allow you to focus on your test, export into a simple format 
then blast it into MSSQL or any other DB.

You are no longer tied to the problem. The developer is now allowed to 'stick' 
those results where ever he wants ;)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6445&messageID=18402#18402
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] how ie.div(:name => 'foo',

2007-02-09 Thread John Lolis
when you make a new thread you have the option of making it a 'question'. If 
you do that then there will be an icon next to each post to mark them as 
correct or mostly correct.

Think its too late now though :)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6479&messageID=18477#18477
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] url for link

2007-02-09 Thread John Lolis
div(:id, "ContractDoc").click

i think that should work
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6325&messageID=18488#18488
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] href javascript

2007-02-09 Thread John Lolis
I looks like this is in a table, figure out which row and cell it is in then do

table(:what,ever)[row][cell].click

that might work.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6498&messageID=18494#18494
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] href javascript

2007-02-09 Thread John Lolis
use the IE dev toolbar and just count it out :)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6498&messageID=18514#18514
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] [NEWBIE] can't convert WIN32OLE into String (TypeError)

2007-02-12 Thread John Lolis
> mainFrame.link(:text,"Recibir Documentos").click
> cmdButtonGo = mainFrame.button(:name,"cmdGo")
> puts cmdButtonGo
> cmdButtonGo.click <-- error here!!!

what are you expecting "puts cmdButtonGo" to do? :)

Message was edited by: 
jlolis
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6525&messageID=18595#18595
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] [NEWBIE] can't convert WIN32OLE into

2007-02-13 Thread John Lolis
> However those others were not helpful. If you check
> the console output i pasted, you will realize that
> puts cmdButton actually works fine and prints the
> properties of the button. Furthermore the error is in
> a "match" function, not in the "puts" function. More
> careful reading next time people!!!

Whoops, my bad. That was my from the hip question.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6525&messageID=18637#18637
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Why this error and how to supress it?

2007-02-15 Thread John Lolis
check the FAQ ( http://wiki.openqa.org/display/WTR/FAQ ) see "Access denied 
when trying to access a frame"

that may be the issue, not sure.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6558&messageID=18718#18718
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] 'ie.close' or 'ie.close if ie'

2007-02-15 Thread John Lolis
I'm not exactly sure why someone would do 'ie.close if ie'. Below is my best 
guess at it.

---

require 'watir'
include Watir

ie = nil

if ie
puts 'ie object created'
else
puts 'no ie object'
endie

ie = IE.new()

if ie
puts 'ie object created'
else
puts 'no ie object'
end
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6562&messageID=18721#18721
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] VBScript Fails with Watir

2007-02-15 Thread John Lolis
What does the actual HTML look like for link you are clicking?

Maybe there is some kind of event that needs to be fired? My gut feeling is 
that you are just 'clicking the wrong thing'.

Again, this is just a wild guess i really have no clue whats going on in here :)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6554&messageID=18756#18756
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] How to call .fireEvent(event, eventObj)?

2007-02-16 Thread John Lolis
find the element that has it and try something like

ie.link(:what,ever).fire_event('even_name')

i think
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6583&messageID=18794#18794
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Watir.. close, but not close enough

2007-02-20 Thread John Lolis
> I think the problem for the OP is that we don't have
> good 
> examples/documentation describing this approach.

I don't feel that its a problem Watir needs to solve. If the community really 
did want some framework I think it would be a project separate from Watir. I'm 
not even sure a project like that would work. Every application that needs 
testing is probably going to need a slightly different approach. If someone 
attempts to write a 'be all end all' framework its probably going to end up 
very complex and hard to understand (see most commercial testing packages).

Watir's strength, to me, is the fact you bring your knowledge of testing and 
coding together. Its a great tool that grows with you and rarely holds you back.

I did in fact run into the problem of a 'test harness', but I asked some 
questions and just tried something - and it failed, i then tossed it and tried 
again - and it worked. I have a strong feeling if and when i try a new project 
it will be even better.

Its kind of a like a hand saw. Anyone with a saw can cut wood, but it truly 
takes experience to cut wood well (too out there?).

Anywho, my 2g's :)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6532&messageID=18925#18925
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] OT: Test unit reporter project dead?

2007-02-20 Thread John Lolis
http://rubyforge.org/frs/?group_id=2857&release_id=9716

I think that will get you want you want
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6596&messageID=18947#18947
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Print statements

2007-02-20 Thread John Lolis
I may be way off base here.

Something has to call those functions to display the puts. As long as "test_1" 
gets called, puts should work. Maybe its just not getting called?

puts "Begin test"

class DNX_1
def test_1
puts "Howdy"
end
end

new_class = DNX_1.new()
new_class.test_1
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6619&messageID=18953#18953
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Nested Frames

2007-02-22 Thread John Lolis
bret, 

I don't have time to look into this right now (too much going on at work), but 
something is up with 1158. I have areas in my app where it just waits forever 
(never used to happen) and its spitting out access denied errors constantly 
(single server). I reverted back to ruby 1.8.2 and 1145 (seems to be the most 
stable pair currently).

the app uses frames heavily.

I'll try to figure it out and post a useful message later or tomorrow, this is 
just a heads up.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6653&messageID=19070#19070
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Nested Frames

2007-02-22 Thread John Lolis
> As a side note, I just found out another possible
>  case where the cross site
> cripting/frame access problems will happen when the
> frames are being served
> by the same domain *and* you have proxy enabled in ie
> which would explain
> some issues I've encountered.

I have frames being served from the same domain and proxy enabled in ie. That 
probably explains it.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6653&messageID=19100#19100
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


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

2007-02-22 Thread John Lolis
I'm no expert on assert, but heres what I would try

Do a puts ie.text (i think there is a text, if not html) and confirm you can 
see it
maybe the text you want is in a different frame?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6663&messageID=19111#19111
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Can Watir be paused & resumed manually when running

2007-02-27 Thread John Lolis
I like using 

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

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

I setup my smoke test to call break point on any exception, i can then hop in 
and see exactly whats going on and fix it.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6704&messageID=19277#19277
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] PopUp window problem

2007-02-28 Thread John Lolis
if i'm reading this right, you click "$ie.button(:value, "Log on").click " and 
it makes a pop up window?

$ie.button(:value, "Log on").click_no_wait
$ie.modal_dialog.button(:value, "close").click 

that might do it. If you have an old version of watir this might not work.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6726&messageID=19347#19347
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Can Watir be paused & resumed manually

2007-02-28 Thread John Lolis
You are looking for some kind of interactive script. I can't imagine its too 
hard to do, but I don't have much time to mess around with it. Heres a fun 
little script i put together to test out an idea. Maybe it will spark some 
ideas.

(note: do not use this for anything, its just for fun. Also, 'gets' blocks all 
threads, so it doesn't even work right. Enjoy :) )

class Console_Test
def run
done = false

while !done
input_string = gets.chomp!

if input_string == 'wait'
puts '*sleeping*'
sleep 5
puts '*awake*'
end

if input_string == 'done'
done = true
puts '*done*'
end
end
end
end

class Testing
def run
done = false
i = 1
while !done
puts 'Current: ' + i.to_s
sleep 1
i += 1

if i > 10
done = true
end
end
end
end


test = Testing.new()
console = Console_Test.new()

threads = []
threads << Thread.new{ console.run() }
threads << Thread.new{ test.run() }

threads.each {|t| t.join }
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6704&messageID=19346#19346
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Selecting an 'accented character' from a list

2007-03-02 Thread John Lolis
Looking for a bit of help here.

I have a select list that has the following value 'Nome do serviço'. 

When I do select_list(whatever).text i get back 'Nome do servi\347o'

if i look in the source of the html i get 'Nome do serviço'

I also found code to convert 'Nome do serviço' to 'Nome do serviço' (but 
thats not what ruby sees)

so...

I need a way to convert 'Nome do serviço' to 'Nome do servi\347o' (i think...)

# Code to convert from 'Nome do serviço' to 'Nome do serviço'
# stolen from somwhere

def entities( str )
  converted = []
  str.split(//).collect { |c| converted << ( c[0] > 127 ? "&##{c[0]};" : c ) }
  converted.join('')
end
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6766&messageID=19489#19489
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Selecting an 'accented character' from a list

2007-03-03 Thread John Lolis
Thank you both for the information.

I can enter the data fine (just need to use an editor that can handle special 
characters). The issue remains that in the html the value is "servi & # 2 3 1 ; 
o" (note i included spaces so you could see all the characters), watir stores 
the value as "Nome do servi\347o"

I know how to convert to the first, but not the second :)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6766&messageID=19514#19514
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Selecting an 'accented character' from a list

2007-03-03 Thread John Lolis
well heres some more code i found, which does the conversion. Now i just need 
to go the other way

string = "Nome do servi\347o"

puts string.gsub(/.$/u, '')

regex = Regexp.new(//u)
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6766&messageID=19515#19515
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Selecting an 'accented character' from a list

2007-03-06 Thread John Lolis
Ok, you guys helped me out more then i thought.

The *real* problem was that i was using single quotes and that my editor was 
corrupting the accented characters.

I now pull the values straight from the db, wrap some basic ruby around them 
and make a translation file. Works like a champ!
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6766&messageID=19591#19591
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Identifying Correct column from multiple header row that spans cells?

2007-03-14 Thread John Lolis
I have no idea if this will help you, i wrote it awhile ago and it still works 
for me. I ripped out as much app specific junk as i could :)

look at 'multi_find' and work your way down. Its not exactly what you want but 
might give you ideas. "find_value" would be values in rows, "find_type" would 
be values in the header.

Also of note, this is note pretty, and has all sorts of hacky bits in it  ;)

# beware of dog

class Support_Grid_Search
def initialize()#stuff removed
@base_table = ''#this would be specific to your app

# Error value 'constant'
@error = -1 
end

def find( find_value, find_type )
if grid_find(find_value, find_type) == @error
return( generic_find( find_value, find_type, 'find' ) )
else
return( true )
end
end

# Multi find DOES NOT SUPPORT GENERIC FIND - deal with it
def multi_find( find_value_a, find_type_a, find_value_b, find_type_b )
if multi_grid_find( find_value_a, find_type_a, find_value_b, 
find_type_b ) == @error
return( false )
else
return( true )
end
end

def multi_grid_find( find_value_a, find_type_a, find_value_b, 
find_type_b )
# Locate both of the header columns
cell_a = find_in_row(1,1,find_type_a)
cell_b = find_in_row(1,1,find_type_b)

if cell_a == @error or cell_b == @error
# 'generic' search
return( @error )
end

# BOTH values have to match in a row, this is annoying O_o
row_count = @base_table.row_count()

for row in (2..row_count)
found_row = find_in_column(cell_a,row,find_value_a)

if found_row == @error
return( @error )
else
result_cell = 
find_in_row(found_row,1,find_value_b)

if result_cell != @error
return( found_row )
end
end 
end
end

# multi means multiple values in the row, not rows to check
def multi_click( find_value_a, find_type_a, find_value_b, find_type_b )
row = multi_grid_find( find_value_a, find_type_a, find_value_b, 
find_type_b )

if row == @error
@logger.log('unable to find row to check')
else
@base_table[row].click
end
end

def check( find_value, find_type ) 
if grid_check(find_value, find_type) == @error
return( generic_find( find_value, find_type, 'check' ) )
else
return( true )
end
end

def grid_check(find_value, find_type)
row = grid_find(find_value, find_type)

if row == @error
return( row )
else

@base_table[row][1].span(:index,1).checkbox(:index,1).set()
return( row )
end
end

def grid_find(find_value, find_type)
# Figure out how many rows there are in the table
row_count = @base_table.row_count()

# If theres only one the grid is empty
if row_count == 1
@logger.log('nothing to search')
return( @error )
end

# Search the 'header' row, figure out what cell (column) 
contains the data we want
cell = find_in_row(1,1,find_type)

# Skip it if  you can't find it
if cell == @error
@logger.log('no column of type: ' + find_type)
return( @error )
end

# Now search down the column and return the results
return( find_in_column(cell,2,find_value) )
end

def find_in_row(row,start_cell,find_value)
cell_count = @base_table.column_count(row)

for cell in start_cell..cell_count
@base_table[row][cell].flash(1)
if @base_table[row][cell].text.gsub(/\r\n/, " 
").include? find_value
return cell
end
end

   

[Wtr-general] Question about "wait_until(n) {element.exists?}"

2007-03-23 Thread John Lolis
waitr 1136

Lets say I have the following action i want to perform

$ie.frame('Frame').table(:id,'ID).table(:index,1)[1][2].click

But, the this is frame heavy page, and wait sometimes doesn't play nice, so I 
decide to do

element = $ie.frame('Frame').table(:id,'ID).table(:index,1)
wait_until(30) { element.exists? }
element[1][2].click

In my mind the above says, "keep looking for element until it exists, if it 
doesn't fail". What happens though is .exists? throws an exception when it 
can't find the element making the whole thing not work.

It seems that exists should never throw an exception, it should always be true 
or false. Yes its there or no its not.

In watir.rb I think this is the offending code
# Returns whether this element actually exists.
def exists?
  begin
locate if defined?(locate)
 rescue WIN32OLERuntimeError
@o = nil
  end
  @o ? true: false
end
alias :exist? :exists?

The rescue doesn't seem to be broad enough. Lower down the stack trace i notice 
that asset_exists is doing the following

unless ole_object
raise UnknownObjectException.new("Unable to locate object, using [EMAIL 
PROTECTED] and [EMAIL PROTECTED]")
end

which exists can't handle. If in exists i make the rescue a 'catch all' 
everything works like a champ (but i'm not sure what effects that has on the 
system).

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


Re: [Wtr-general] Watir can't find IEnum interface

2007-03-26 Thread John Lolis
Ruby 182-15, Watir 1.5.1.1136

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


Re: [Wtr-general] .Can we set the Watir's time_out_value in the script?

2007-03-28 Thread John Lolis
class Watir::IE
@@attach_timeout = 10
end

I think that should work
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Question about "wait_until(n) {element.exists?}"

2007-03-28 Thread John Lolis
Thanks for the feedback everyone,

Heres another way of approaching the problem. This takes the current wait_until 
it makes it tolerant to exceptions. This seems to have the desired effect. I 
don't think this should be used for any real code, just food for thought.

require 'watir'   
include Watir

class Waiter
def wait_until
start_time = now

begin
until yield do
timed_out?(start_time, timeout)
end
rescue
if !timed_out?(start_time, timeout)
retry
end
end
end

# this is kind of odd, there is no true!
def timed_out?(incoming_start_time, incoming_timeout)
duration = now - incoming_start_time

if (duration) > incoming_timeout
raise Watir::Exception::TimeOutException.new(duration, 
incoming_timeout),
"Timed out after #{duration} seconds."
else
sleep @polling_interval
return( false )
end
end
end

ie = IE.new
ie.goto('http://www.google.com')

p wait_until(2){ true }
p wait_until(2){ ie.button(:name, 'btnG').exists? }

begin
wait_until(2){ ie.frame('FakeFrame').exists? }
rescue Watir::Exception::TimeOutException
puts "Can't find element"
end
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] watir execution from webserver

2007-03-28 Thread John Lolis
areed,

I have noticed that paths in ruby are relative to file that is being executed ( 
i think ). This has caused a couple of head scratching moments on my part while 
i wonder they files will no longer load using relative paths.

I'm not sure this is related to your problem, hope it helps.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Saving the state of your test using yaml

2007-03-29 Thread John Lolis
This is something I've started using and I figured others might find it useful.

The main form of testing I have been doing is a 'smoke test'. This is a complex 
test that takes about 20 minutes to setup data to get the expected results at 
the end. The issue i ran into with this is that the system would on occasion 
fail, or I would need to fix certain sections by hand and continue the test. I 
had to figure out a way of 'saving' the state of the test and continuing, thus 
Yaml.

This is a very basic setup, i tried to lay it out in a simple way.

On to the code!

# Setup the basics
require 'watir'
include Watir

# This allows us to use the Ruby Yaml library
require 'yaml'

# The global IE just makes things easy for the test
$ie = IE.new()

class Google
# A 'go' function, in my these are the gate keepers of every page
def go()
$ie.goto('http://www.google.com')
wait_until(5){ $ie.text_field(:name,'q').exists? }
end

# for this test, the methods are named steps to make things easy
def step_1(data)
@data = data
end

def step_2()
$ie.text_field(:name,'q').set(@data)
end
end

# Setup our Google object
google = Google.new()
google.go()
google.step_1('search text')

# Convert the Google object to YAML
yaml_string = google.to_yaml

# Create a new object using the YAML and continue
# Note THIS is the magic part. You could save the string to disk or do any 
number of things with it.
google_new = YAML::load(yaml_string)
google_new.step_2
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] How to check presence of link by using begin -

2007-03-29 Thread John Lolis
wait_until(time_in_seconds){ ie.element(:type,value).exists? }

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


Re: [Wtr-general] IDEs for Watir

2007-03-29 Thread John Lolis
Jason,

I started off using Mondrian ( http://www.mondrian-ide.com/ ) and at first 
really liked the structure if gave me. I came from Visual Studio .Net so I was 
very used to the 'Heavy IDE' format.

The problem is I started to have growing pains with with it. I noticed that it 
was slowing down my work, forcing artificial constraints on me and, on very 
rare occasion crashing (unacceptable for an IDE in my opinion).

I switched to a very organized file structure, and scite. I run the program 
using a batch file so i get the standard console window. The batch file also 
includes a 'pause' command so that at the end of the program it doesn't close 
the console.

I miss multi file find, search and replace - but i can just find a better 
editor for that. I personally enjoy the freedom of no overhead, just me and 1 
million scite windows open.

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


Re: [Wtr-general] problem in identifying the button

2007-03-30 Thread John Lolis
also it looks like its in a table so you could do

table(:type,'value')[row][column].click
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Localization made 'easier' with yaml

2007-03-30 Thread John Lolis
Another example i thought i would share. Again I tried to keep the code very 
readable. This example should be enough to get anyone going. I'm currently 
using this with a DB and storing the yaml in a file, it works great!

I'll let the code and comments speak for itself, it should be readable.



# Lets require all the basics
require 'watir'
require 'yaml'

include Watir

# Using a global IE just to keep things simply
$ie = IE.new()

class Translation
def generate_translation_string()
# Lets setup the hash to hold the data
localized_string_hash = Hash.new()

# Now lets populate the hash
# In my siutation this is done from a DB and each string has a 
unique value
# for example GOOGLE_SEARCH_ENGLISH, and GOOGLE_SEARCH_FRENCH
# I left it english and french to keep it simple
localized_string_hash["english"] = "Google Search"
localized_string_hash["french"] = "Recherche Google"

# this sends back the hash as yaml
# I tend to generate this only when strings change and store a 
copy of it in a file
localized_string_hash.to_yaml
end 
end

class Google
# Gate keeper, call this first to make sure we are where we should be
def go()
$ie.goto('http://www.google.com')
wait_until(5){ $ie.text_field(:name,'q').exists? }
end

# the meat of it
def verify_title(compare_title)
if $ie.text_field(:name,'q').title == compare_title
puts 'Title Compare: Pass'
else
puts 'Title Compare: Fail'
end
end
end

# Setup our Google object
google = Google.new()

# Now setup our translation object
translation = Translation.new()

# Get the yaml translation string
yaml_string = translation.generate_translation_string()

# Lets look at it
# Its very simple!
puts yaml_string

# Load it into a new hash
new_hash = YAML::load( yaml_string )

# Navigate to Google
google.go()

# Now the magic
google.verify_title(new_hash["english"])
google.verify_title(new_hash["french"])
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Assert Dates?

2007-04-02 Thread John Lolis
Thanks for the demo Chris, I haven't messed with dates beyond the basics, this 
was a nice way to get brought up to speed.

While my first thoughts were along the lines of Chris, I think I would go with 
the string compare. It seems, in his case, that the level of complexity isn't 
needed. I can see many situation wheres having the option of using real dates 
would be useful, but the case for simplicity over 'correctness' needs to be 
made too.

Just my 2c, thanks again for the sample code!
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] little framework

2007-04-02 Thread John Lolis
Looks good.

In your setup I would wrap $ie with a global function (internet_explorer or 
some such). I would then use that global function through out your class files. 
This could save you a headache down the road :)
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] How to check for the presence of a frame in a page?

2007-04-03 Thread John Lolis
Take a look at this thread

http://forums.openqa.org/thread.jspa?threadID=7082&tstart=30

I give some ideas on how to approach a very similar problem.

The easy option to catch the specific exception and handle it from there.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Using Until

2007-04-03 Thread John Lolis
I'm not sure how new 'wait_until' is, but if you have it do

wait_until(time_to_wait_in_seconds){ $ie.element(:type,'value').exists? }
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Basic question re looping

2007-04-12 Thread John Lolis
Give this a shot

require 'watir'
include Watir

# Lets setup our data so the code is easier to read
url = "http://www.google.co.uk";
search_string   = "barry manilow"
target_url  = "http://www.classicbands.com/manilow.html";

# Get IE ready to go
ie = IE.new

# Goto the website
ie.goto(url)

# Set the text in the search box
ie.text_field(:name, 'q').set(search_string)

# Click the search button
ie.button(:name, 'btnG').click

# Lets setup the control to our loop
found = false

# "While NOT found" (ie, keep searching until it IS found)
while !found
# If the link exists, do the following
if ie.link(:url, target_url).exists?
ie.link(:url, target_url).click
found = true
# If not keep searching
else
ie.div(:id, 'nn').click
end
end

# The end
___
Wtr-general mailing list
[EMAIL PROTECTED]
http://rubyforge.org/mailman/listinfo/wtr-general


  1   2   >