Re: [Wtr-general] Wait for control to exist

2006-06-13 Thread Andy Sipe
I'm not sure of the syntax, but I'd like to see it support multiple elements 
being verified.

-andy

Original Message Follows
From: Bret Pettichord [EMAIL PROTECTED]
Reply-To: wtr-general@rubyforge.org
To: wtr-general@rubyforge.org
Subject: [Wtr-general] Wait for control to exist
Date: Tue, 13 Jun 2006 00:54:16 -0500

So, i think everyone can at least agree that it would be nice to have a
method on Watir elements that would not return until the element appeared on
a page. E.g.:

  ie.button(:value, OK).dont_return_until_this_element_exists

This would be analogous to the existing ie.wait method, except that that
waits for the page to load the browser to no longer be busy.

The only thing is -- what should it be called?

Some ideas...

  ie.button(:value, OK).wait_until_exists?
  ie.button(:value, OK).wait_til_exist?
  ie.button(:value, OK).wait
  ie.button(:value, OK).ever_exist?

Bret


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


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


Re: [Wtr-general] Wait for control to exist

2006-06-13 Thread Bret Pettichord
On 6/13/06, Andy Sipe [EMAIL PROTECTED] wrote:
I'm not sure of the syntax, but I'd like to see it support multiple elementsbeing verified.-andyHow about this ?ie.button(:value, OK).wait_til_existsie.button(:value, Cancel).wait_til_exists
Bret
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Wait for control to exist

2006-06-13 Thread Bret Pettichord
On 6/13/06, David Schmidt [EMAIL PROTECTED] wrote:
I called the function I wrote wait_for, though I like youruntil_with_timeout method that uses yield better.Then we could do something like:wait_for(10) { ie.button(:value, 'OK') }or just do it as a function like
wait_for( ie.button(:value, 'OK'), 10 )How about this: wait_until(ie.button(:value, OK).exists?, 10)The advantage of this form is that we could use any boolean _expression_. So you could wait until a control was disabled or whatever. I'm not 100% sure that i can code this, however. I know i can implement using a block. Thus:
 wait_until(10) {ie.button(:value, OK).exists?}This, of course, is the existing until_with_timeout method. Or: ie.button(:value, OK).wait_until_exists?(10)Which follows the normal Watir practice if putting the methods on the elements.
Note that in all these examples the timeout would be optional and would default to a user-configurable value. Probably @@default_timeout. Also, if the timeout were exceeded, it would raise a TimeOutException.
BretWe could just use your until_with_timeout as is, too:until_with_timeout(10) { 
ie.button(:value, 'OK').exists? }I've been using that already to wait for AJAX events to complete bywatching for a spinner to appear and then disappear:# wait for Updating spinner to appear
Watir::until_with_timeout(5) do@ie.div(:id, 'pnlLoading').document.style.invoke('display')!= 'none' @ie.div(:id,'pnlLoading').document.style.invoke('visibility') != 'hidden'
end# wait for Updating spinner to hideWatir::until_with_timeout(30) do@ie.div(:id, 'pnlLoading').document.style.invoke('display')== 'none' ||@
ie.div(:id,'pnlLoading').document.style.invoke('visibility') == 'hidden'endWe may wish to make it a bit more visible though, so it can be usedwithout the Watir:: at the front.
I agree and will make that change regardless.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Wait for control to exist

2006-06-13 Thread Adrian Rutter
Brett wrote

 The only thing is -- what should it be called?

wait_for_object?

Maybe with a default timeout in the initialize method when a parameter is
not sent.

wait_for_object  #default
wait_for_object(5000) #milliseconds

Aidy



---
This message and any attachment are confidential and may be privileged or 
otherwise protected from disclosure. 
If you are not the intended recipient, please telephone or email the sender and 
delete this message and any attachment from your system.  
If you are not the intended recipient you must not copy this message or 
attachment or disclose the contents to any other person.
---
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Wait for control to exist

2006-06-13 Thread Andy Sipe
That woudl work.

What would be nice would be something like this:

@ie.wait(10) {
  button(:id, 'btnOne)
  span(:id, 'blah')
}

I'm not sure how that would translate into working code though.

Also, is it enough to just check that the item exists?  Often I have items 
that are being updated via AJAX style code and they exist, but they are 
changing, so I'm looking to see if the value is something specific or 
something different than last time.   If I had the polling on exist it 
wouldn't be enough.

-andy



Original Message Follows
From: Bret Pettichord [EMAIL PROTECTED]
Reply-To: wtr-general@rubyforge.org
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Wait for control to exist
Date: Tue, 13 Jun 2006 08:22:42 -0500

On 6/13/06, Andy Sipe [EMAIL PROTECTED] wrote:

I'm not sure of the syntax, but I'd like to see it support multiple
elements
being verified.

-andy


How about this ?

ie.button(:value, OK).wait_til_exists
ie.button(:value, Cancel).wait_til_exists

Bret


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


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


[Wtr-general] Problem finding a link URL with RegEx

2006-06-13 Thread Adrian Rutter
I have got 2 'New' links in one HTML page.

The second link has a URL as this:


http://gbahevm07l15:9081/wps/myportal/!ut/p/kcxml/04_Sj9SPykssy0xPLMnMz0vM0Y_QjzKLN4i3dAHJgFjGpvqRqCKOcAFfj_zcVKBwpDmQ726kH5abmZeZm1mVmgITdAvDImjoFIBN1MhbPywvvygX6IoQuKGG2AwNRRYMQhgQoO-tH6BfkBsaUW6ca2GcG-BnWubsCADEVrkI/delta/base64xml/L0lDVE83b0pKN3VhQ1NZSkNncFJDZ3BSQS9ZSVVJQUFJSUlJSUlJTU1JSUlNSUlDQ0lHRUVBSktPQk9CS09KRkpGS0pBIS80QjFpY29uUVZ3R3hPVVRvSzc5WVFyTmh6RGNJN0RsRzR4QSEvN18wXzEyUC8xMTQyNS9zcGZfQWN0aW9uTmFtZS9zcGZfQWN0aW9uTGlzdGVuZXIvc3BmX3N0cnV0c0FjdGlvbi8lMG5ld1RlcnJpdG9yeUJJQy5kbw!!#7_0_12P


The beginning and end will always be the same whatever environments
i.e.

http://gbahevm07l15:9081/wps/myportal  7_0_12P


This is the regex I have used without success

http://gbahevm07l15:9081/wps/myportal\/.*/7_0_12P

$ie.link(:url, 'http://gbahevm07l15:9081/wps/myportal\/.*/7_0_12P').click

Could anyone help?

Aidy



---
This message and any attachment are confidential and may be privileged or 
otherwise protected from disclosure. 
If you are not the intended recipient, please telephone or email the sender and 
delete this message and any attachment from your system.  
If you are not the intended recipient you must not copy this message or 
attachment or disclose the contents to any other person.
---
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Problem finding a link URL with RegEx

2006-06-13 Thread Zeljko Filipin
Try this:$ie.link(:url, /http:\/\/gbahevm07l15:9081\/wps\/myportal.*7_0_12P/).clickOn 6/13/06, Adrian Rutter 
[EMAIL PROTECTED] wrote:I have got 2 'New' links in one HTML page.
The second link has a URL as this:
http://gbahevm07l15:9081/wps/myportal/!ut/p/kcxml/04_Sj9SPykssy0xPLMnMz0vM0Y_QjzKLN4i3dAHJgFjGpvqRqCKOcAFfj_zcVKBwpDmQ726kH5abmZeZm1mVmgITdAvDImjoFIBN1MhbPywvvygX6IoQuKGG2AwNRRYMQhgQoO-tH6BfkBsaUW6ca2GcG-BnWubsCADEVrkI/delta/base64xml/L0lDVE83b0pKN3VhQ1NZSkNncFJDZ3BSQS9ZSVVJQUFJSUlJSUlJTU1JSUlNSUlDQ0lHRUVBSktPQk9CS09KRkpGS0pBIS80QjFpY29uUVZ3R3hPVVRvSzc5WVFyTmh6RGNJN0RsRzR4QSEvN18wXzEyUC8xMTQyNS9zcGZfQWN0aW9uTmFtZS9zcGZfQWN0aW9uTGlzdGVuZXIvc3BmX3N0cnV0c0FjdGlvbi8lMG5ld1RlcnJpdG9yeUJJQy5kbw!!#7_0_12P
The beginning and end will always be the same whatever environmentsi.e.http://gbahevm07l15:9081/wps/myportal7_0_12P
This is the regex I have used without successhttp://gbahevm07l15:9081/wps/myportal\/.*/7_0_12P$ie.link(:url, '
http://gbahevm07l15:9081/wps/myportal\/.*/7_0_12P').clickCould anyone help?Aidy---
This message and any attachment are confidential and may be privileged or otherwise protected from disclosure.If you are not the intended recipient, please telephone or email the sender and delete this message and any attachment from your system.
If you are not the intended recipient you must not copy this message or attachment or disclose the contents to any other person.---
___Wtr-general mailing listWtr-general@rubyforge.orghttp://rubyforge.org/mailman/listinfo/wtr-general

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

Re: [Wtr-general] Problem finding a link URL with RegEx

2006-06-13 Thread Adrian Rutter
Thanks for the correct RegEx; it finds an object, but not the  one I want.

The below are the url's of the second 'Filter' and 'New' links. They are
hardly different and I am sure they will change in a different environment,
so I can't hard-code them


http://gbahevm07l15:9081/wps/myportal/!ut/p/kcxml/04_Sj9SPykssy0xPLMnMz0vM0Y_QjzKLN4i3dAHJgFjGpvqRqCKOcAFfj_zcVKBwpDmQ726kH5abmZeZm1mVmgITdAvDImjoFIBN1MhbPywvvygX6IoQuKGG2AwNRRYMQhgQoO-tH6BfkBsaUW6ca2GcG-BnWubsCADEVrkI/delta/base64xml/L0lDVE83b0pKN3VhQ1NZSkNncFJDZ3BSQS9ZSVVJQUFJSUlJSUlJTU1JSUlNSUlDQ0lHRUVBSktPQk9CS09KRkpGS0pBIS80QjFpY29uUVZ3R3hPVVRvSzc5WVFyTmh6RGNJN0RsRzR4QSEvN18wXzEyUC8xMTQyNS9zcGZfQWN0aW9uTmFtZS9zcGZfQWN0aW9uTGlzdGVuZXIvc3BmX3N0cnV0c0FjdGlvbi8lMG5ld1RlcnJpdG9yeUJJQy5kbw!!#7_0_12P

http://gbahevm07l15:9081/wps/myportal/!ut/p/kcxml/04_Sj9SPykssy0xPLMnMz0vM0Y_QjzKLN4i3dAHJgFjGpvqRqCKOcAFfj_zcVKBwpDmQ726kH5abmZeZm1mVmgITdAvDImjoFIBN1MhbPywvvygX6IoQuKGG2AwNRRYMQhgQoO-tH6BfkBsaUW6ca2GcG-BnWubsCADEVrkI/delta/base64xml/L0lDVE83b0pKN3VhQ1NZSkNncFJDZ3BSQS9ZSVVJQUFJSUlJSUlJTU1JSUlNSUlDQ0lHRUVBSktPQk9CS09KRkpGS0pBIS80QjFpY29uUVZ3R3hPVVRvSzc5WVFyTmh6RGNJN0RsRzR4QSEvN18wXzEyUC8xMzc3Ni9zcGZfQWN0aW9uTmFtZS9zcGZfQWN0aW9uTGlzdGVuZXIvc3BmX3N0cnV0c0FjdGlvbi8lMHNob3dUZXJyaXRvcnlCSUNTZWFyY2guZG8!#7_0_12P


Is it not possible to get the second link on a page? Something like:


$ie.link(:text, 'New';:index, 2).click

Cheers

Aidy



---
This message and any attachment are confidential and may be privileged or 
otherwise protected from disclosure. 
If you are not the intended recipient, please telephone or email the sender and 
delete this message and any attachment from your system.  
If you are not the intended recipient you must not copy this message or 
attachment or disclose the contents to any other person.
---
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Problem finding a link URL with RegEx

2006-06-13 Thread Michael Bolton
Thanks for the correct RegEx; it finds an object, but not the  one I want.

Is it not possible to get the second link on a page? Something like:

$ie.link(:text, 'New';:index, 2).click

Possibly--but this might be a good occasion to ask the developers for
testability.

---Michael B.

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


Re: [Wtr-general] Problem finding a link URL with RegEx

2006-06-13 Thread Adrian Rutter

MB wrote:

 Possibly--but this might be a good occasion to ask the developers for
testability.

I think Websphere Portal instantiates each object dynamically and according
to the developers, there is nothing they can do.

Aidy



---
This message and any attachment are confidential and may be privileged or 
otherwise protected from disclosure. 
If you are not the intended recipient, please telephone or email the sender and 
delete this message and any attachment from your system.  
If you are not the intended recipient you must not copy this message or 
attachment or disclose the contents to any other person.
---
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Wait for control to exist

2006-06-13 Thread David Schmidt
How about the easy way.  Just alias your nice until_with_timeout to 
wait_until so both names work and just use that your first format with 
the block.  That way the block can contain any code that returns a 
boolean, which will allow Andy's request for multiple element support to 
work like:

wait_until(timeout) { ie.button(:id, 'btnOne').exists? and ie.span(:id, 
'blah').exists? }

with the timeout being optional and using a default_timeout like Bret 
suggests below.

This can then support all *sorts* of things that folks wait for, 
including thing like the displayed spinners that I was waiting to 
appear and then disappear.

David

Bret Pettichord wrote:
 How about this:

   wait_until(ie.button(:value, OK).exists?, 10)

 The advantage of this form is that we could use any boolean 
 expression. So you could wait until a control was disabled or 
 whatever. I'm not 100% sure that i can code this, however. I know i 
 can implement using a block. Thus:

   wait_until(10) {ie.button(:value, OK).exists?}

 This, of course, is the existing until_with_timeout method. Or:

   ie.button(:value, OK).wait_until_exists?(10)

 Which follows the normal Watir practice if putting the methods on the 
 elements.

 Note that in all these examples the timeout would be optional and 
 would default to a user-configurable value. Probably 
 @@default_timeout. Also, if the timeout were exceeded, it would raise 
 a TimeOutException.

 Bret

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


Re: [Wtr-general] Problem finding a link URL with RegEx

2006-06-13 Thread David Schmidt
Adrian Rutter wrote:
 Is it not possible to get the second link on a page? Something like:

 $ie.link(:text, 'New';:index, 2).click
   
It is currently possible to access the second link on a page, but not 
with a filter.  '$ie.links[2]' will give you the second link on the 
page, and you can open the page in IRB and do '$ie.show_links' to see 
which index to use for the link you want.

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


Re: [Wtr-general] Wait for control to exist

2006-06-13 Thread Bret Pettichord
On 6/13/06, David Schmidt [EMAIL PROTECTED] wrote:
How about the easy way.Just alias your nice until_with_timeout towait_until so both names work and just use that your first format withthe block.That way the block can contain any code that returns a
boolean, which will allow Andy's request for multiple element support towork like:wait_until(timeout) { ie.button(:id, 'btnOne').exists? and ie.span(:id,'blah').exists? }with the timeout being optional and using a default_timeout like Bret
suggests below.This can then support all *sorts* of things that folks wait for,including thing like the displayed spinners that I was waiting toappear and then disappear.
+1Except that the old until_with_timeout method will be replaced by (rather than aliased to) wait_untilBTW, the existing until_with_timeout method had been intended for internal use only and that's why it is kinda ugly.
Bret
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Problem finding a link URL with RegEx

2006-06-13 Thread Bret Pettichord
Adrian Rutter wrote: Is it not possible to get the second link on a page? Something like:
 $ie.link(:text, 'New';:index, 2).clickUsing 1.5.1.1037 try this: $ie.link(:text = 'New', :index = 2).click I added multiple attribute support last night for links.
Bret
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] Load site without images?

2006-06-13 Thread Christian Baumann
Hello!

Is it possible to execute watir-scripts without loading the images in a
website?
I´m on a dialup and have a real bandwith-problem; and for the execution
of my
testcases loading of the images isn´t necessary.

Thanks in advance,
Christian


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


Re: [Wtr-general] Load site without images?

2006-06-13 Thread Bret Pettichord
On 6/13/06, Christian Baumann [EMAIL PROTECTED] wrote:
Is it possible to execute watir-scripts without loading the images in awebsite?I´m on a dialup and have a real bandwith-problem; and for the executionof mytestcases loading of the images isn´t necessary.
Just turn off this option in IE's Internet Options.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Load site without images?

2006-06-13 Thread Mike Townley
You can tell IE to not load images. You'll need to click Internet Options from 
the Tools menu. In the new window that opens, click the Advanced tab on the far 
right. Scroll down the list until you see the Multimedia category and click the 
checkbox next to Show Pictures to uncheck it, then click Apply and OK.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christian Baumann
Sent: Tuesday, June 13, 2006 2:38 PM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] Load site without images?

Hello!

Is it possible to execute watir-scripts without loading the images in a
website?
I´m on a dialup and have a real bandwith-problem; and for the execution
of my
testcases loading of the images isn´t necessary.

Thanks in advance,
Christian


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


[Wtr-general] Trouble with links in a div

2006-06-13 Thread kwan l


Hi, 
I've just started using Watir and have run into a problem with links inside of divs.

example page:
htmlhead/headbodydiv id="div1"a href="">Googlehttp://www.google.com"Google/a/div/body/html
when i try the script:
require 'Watir'
ie = Watir::IE.start("C:\\testwatir.html")
# Test initial displaywpdiv = ie.div(:id, "div1")wpdiv.link(:index, 1).clickie.close

I get an error saying that, "document" is undefined. This happens in the "getLink" method.

Can anybody explain what I am doing incorrectly? 

Thanks

KwanLa future messagerie instantanée : Essayez gratuitement Windows Live Messenger Beta
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Wait for control to exist

2006-06-13 Thread David Schmidt
Our solution is better than that.  Bret already has a method that I've 
been using and it's generic enough that you can wait for just about 
anything.  He's stated that he'll just be renaming it to wait_for.

On a web scraper I have there is an AJAX request that fires when one of 
the fields is changed.  When this happens, a graphical spinner image 
appears to let you know it's making a request.  The spinner is always 
there, but the DIV containing it gets changed from hidden to visible and 
back again.

I'm able to wait for the style to change to visible and then wait for 
the style to change to hidden (even though the DIV *always* exists) like 
this (using the new wait_for() method name):

  # wait for Updating spinner to appear
  wait_for(5) do
@ie.div(:id, 'pnlLoading').document.style.invoke('display') != 'none' 
@ie.div(:id, 'pnlLoading').document.style.invoke('visibility') != 'hidden'
  end

  # wait for Updating spinner to hide
  wait_for(30) do
@ie.div(:id, 'pnlLoading').document.style.invoke('display') == 'none' ||
@ie.div(:id, 'pnlLoading').document.style.invoke('visibility') == 'hidden'
  end

The wait_for method will just keep trying the supplied block until the block
returns true or the timeout has passed (where it will throw an exception).

David


Andy Sipe wrote:
 I'm not sure just exist is enough for what I'm talking about.

 If I have a span that already exists in the document and I do something that 
 causes an async request/update to the server then the span always exists so 
 saying:

 span(:id, ...).wait_for_exists?

 may blow right through without pausing because the span is there.

 Maybe something like

 span(:id, ...).wait_for_change('text', 'blah')

 where 'text' is the attribute i'm waiting to change and 'blah' is the value 
 I'm waiting for it to change to.

 So you could also do

 span(:id, ...).wait_for_change('exists?', true)

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


Re: [Wtr-general] Wait for control to exist

2006-06-13 Thread Bret Pettichord
On 6/13/06, David Schmidt [EMAIL PROTECTED] wrote:
The wait_for method will just keep trying the supplied block until the blockreturns true or the timeout has passed (where it will throw an exception).We want it to be called wait_until -- correct?

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

Re: [Wtr-general] Wait for control to exist

2006-06-13 Thread David Schmidt
Yup, my bad.  I just typed the wrong name out of habit.  New name will 
be wait_until.

*SLAP*

Ouch!

OK, I've been punished.

David

Bret Pettichord wrote:
 On 6/13/06, *David Schmidt* [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:

 The wait_for method will just keep trying the supplied block until
 the block
 returns true or the timeout has passed (where it will throw an
 exception).


 We want it to be called wait_until -- correct? 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Trouble with links in a div

2006-06-13 Thread Bret Pettichord
On 6/13/06, kwan l [EMAIL PROTECTED] wrote:




ie = Watir::IE.start(C:\\testwatir.html)Try this instead:Watir::IE.start(file:///C:/testwatir.html)Bret

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

Re: [Wtr-general] Wait for control to exist

2006-06-13 Thread Bret Pettichord
I've written this up as http://jira.openqa.org/browse/WTR-75
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Wait for control to exist

2006-06-13 Thread Andy Sipe
That sounds great.  I didn't realize that was what you were talking about.

Thanks -andy


Original Message Follows
From: David Schmidt [EMAIL PROTECTED]
Reply-To: wtr-general@rubyforge.org
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Wait for control to exist
Date: Tue, 13 Jun 2006 14:28:41 -0700

Our solution is better than that.  Bret already has a method that I've
been using and it's generic enough that you can wait for just about
anything.  He's stated that he'll just be renaming it to wait_for.

On a web scraper I have there is an AJAX request that fires when one of
the fields is changed.  When this happens, a graphical spinner image
appears to let you know it's making a request.  The spinner is always
there, but the DIV containing it gets changed from hidden to visible and
back again.

I'm able to wait for the style to change to visible and then wait for
the style to change to hidden (even though the DIV *always* exists) like
this (using the new wait_for() method name):

   # wait for Updating spinner to appear
   wait_for(5) do
 @ie.div(:id, 'pnlLoading').document.style.invoke('display') != 'none' 

 @ie.div(:id, 'pnlLoading').document.style.invoke('visibility') != 
'hidden'
   end

   # wait for Updating spinner to hide
   wait_for(30) do
 @ie.div(:id, 'pnlLoading').document.style.invoke('display') == 'none' 
||
 @ie.div(:id, 'pnlLoading').document.style.invoke('visibility') == 
'hidden'
   end

The wait_for method will just keep trying the supplied block until the block
returns true or the timeout has passed (where it will throw an exception).

David


Andy Sipe wrote:
  I'm not sure just exist is enough for what I'm talking about.
 
  If I have a span that already exists in the document and I do something 
that
  causes an async request/update to the server then the span always exists 
so
  saying:
 
  span(:id, ...).wait_for_exists?
 
  may blow right through without pausing because the span is there.
 
  Maybe something like
 
  span(:id, ...).wait_for_change('text', 'blah')
 
  where 'text' is the attribute i'm waiting to change and 'blah' is the 
value
  I'm waiting for it to change to.
 
  So you could also do
 
  span(:id, ...).wait_for_change('exists?', true)
 
  -andy
 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


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


Re: [Wtr-general] Trouble with links in a div

2006-06-13 Thread kwan l


Thanks Bret, but i still get the same error. 

Creating the "ie" instance works fine. It fails when I try to reference the link inside the div tag.

I peeked in the code for "getLink" and it fails at the lines :

 def getLink( how, what )  links = document.all.tags("A")
Apparently, the document object is nil. Accessing the link from the "ie" instance also calls "getLink" but in that case the document object isn't nil. It's only nil when I access the "link" collection of the div object. I'm not quite sure what's going on here ...
Kwan


Date: Tue, 13 Jun 2006 17:51:46 -0500From: [EMAIL PROTECTED]To: wtr-general@rubyforge.orgSubject: Re: [Wtr-general] Trouble with links in a divOn 6/13/06, kwan l [EMAIL PROTECTED] wrote:



ie = Watir::IE.start("C:\\testwatir.html")
Try this instead:Watir::IE.start("file:///C:/testwatir.html")Bret Votre nouvelle utilisation de la messagerie : Windows Live Messenger Beta
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] Drop Down Lists (li)

2006-06-13 Thread Andy Case


I am new to 
WATIR/RUBY and have run into difficulty with a drop down list, example HTML 
below.
The example 
documentation doesn't seem to cover this.

Can anyone suggest 
how I would use WATIR to select the drop down options?

 div 
id="nav1" a 
name="nav1"/a ul id="udm" 
class="udm" 
li a 
class="nohref"Registration/a 
ul 
style="width:190%" 
lia style="white-space:nowrap" 
href=""List Learning 
Accounts/a/li 
lia style="white-space:nowrap" 
href=""Search Learning 
Accounts/a/li 
lia style="white-space:nowrap" 
href=""Register Individual 
Learner/a/li 
lia style="white-space:nowrap" 
href=""Register Multiple 
Learners/a/li 
lia style="white-space:nowrap" 
href=""Enrol Individual 
Learner/a/li 
lia style="white-space:nowrap" 
href=""Manage Multiple 
ILOs/a/li 
/ul 
/li 
li a 
class="nohref"Banking of 
Credits/a 
ul 
style="width:135%" 
lia style="white-space:nowrap" 
href=""List Learning 
Accounts/a/li 
lia style="white-space:nowrap" 
href=""Search Learning 
Accounts/a/li 
lia style="white-space:nowrap" 
href=""Manage 
Courses/a/li 
/ul 
/li
cheers
Andy
~~
This email (including any attached files) is for the intended 
recipient(s) only. If you received this email by mistake, please, 
as a courtesy, tell the sender, then delete this email.

The views and opinions are the originator's and do not necessarily 
reflect those of the Queensland Studies Authority. All reasonable 
precautions have been taken to ensure that this email contained no 
viruses at the time it was sent.

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

Re: [Wtr-general] Trouble with links in a div

2006-06-13 Thread Bret Pettichord
On 6/13/06, kwan l [EMAIL PROTECTED] wrote:




Apparently, the document object is nil. Accessing the link from the ie instance also calls getLink but in that case the document object isn't nil. It's only nil when I access the link collection of the div object. I'm not quite sure what's going on here ...
I think you may need to use 1.5 to get nested objects to work. It only worked for a few objects in 1.4.1.Bret 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general