[Wtr-general] not exactly watir but a ruby question

2006-08-11 Thread Manish Sapariya
Hi,
How do break out of x.times loop.

10.times do
  findWindowLike(nil, /^Microsoft Internet Explorer$/, //) {|win|
  puts #{win.getClassName}\t#{win.getWindowText}
  #p win.getWindowRect
  #p win
 
  if(win.getParent().hwnd == $ie.hwnd) then
#p $ie.hwnd, win.getParent().hwnd
popupwin=win
p Found appropriate parent...Breaking
break
  end
}
p Waiting for one sec for diaog to show up
sleep 1
end

My break in the if condition, when I find if the child is indeed the
child of my ie window, is not working as expected.

Is this correct ruby usage?
Can anyone suggest any other way to retry my waiting mechanism or the
child dialog to appear which is spawned by my IE browser.

Thanks and Regards,
Manish

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


Re: [Wtr-general] not exactly watir but a ruby question

2006-08-11 Thread Dave Hoover
On 8/11/06, Manish Sapariya [EMAIL PROTECTED] wrote:
 Hi,
 How do break out of x.times loop.

Here's one answer to your question...
http://permalink.gmane.org/gmane.comp.lang.ruby.general/21817
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] not exactly watir but a ruby question

2006-08-11 Thread Jeff Wood




Manish Sapariya wrote:

  Hi,
How do break out of x.times loop.

10.times do
  findWindowLike(nil, /^Microsoft Internet Explorer$/, //) {|win|
  puts "#{win.getClassName}\t#{win.getWindowText}"
  #p win.getWindowRect
  #p win
 
  if(win.getParent().hwnd == $ie.hwnd) then
#p $ie.hwnd, win.getParent().hwnd
popupwin=win
p "Found appropriate parent...Breaking"
break
  end
}
p "Waiting for one sec for diaog to show up"
sleep 1
end

My break in the if condition, when I find if the child is indeed the
child of my ie window, is not working as expected.

Is this correct ruby usage?
Can anyone suggest any other way to retry my waiting mechanism or the
child dialog to appear which is spawned by my IE browser.

Thanks and Regards,
Manish

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


irb(main):001:0 10.times { |x| puts x; break if x == 3 }
0
1
2
3
= nil
irb(main):002:0


... your syntax should work.

jd



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

Re: [Wtr-general] Wtr-general Digest, Vol 33, Issue 19

2006-08-11 Thread Lonny Eachus





Manish, your break is working. But it is breaking out of your code
block, not your "times" loop.

{|win|

 puts "#{win.getClassName}\t#{win.getWindowText}"

 #p win.getWindowRect

 #p win

  if(win.getParent().hwnd == $ie.hwnd) then

 #p $ie.hwnd, win.getParent().hwnd

 popupwin=win

 p "Found appropriate parent...Breaking"

 break

 end

 }


If I am not mistaken, this block amounts to an "iterator controlled
loop". So "break" will get you out of this block, but if you want out
of your times loop, you will have to do "break break".

Lonny Eachus
==


  

  

Subject:

[Wtr-general] not exactly watir but a ruby question
  
  

From: 
Manish Sapariya [EMAIL PROTECTED]
  
  

Date: 
Fri, 11 Aug 2006 15:28:36 +0530
  

  
  
Hi,
  
How do break out of x.times loop.
  
  
10.times do
  
 findWindowLike(nil, /^Microsoft Internet Explorer$/, //) {|win|
  
 puts "#{win.getClassName}\t#{win.getWindowText}"
  
 #p win.getWindowRect
  
 #p win
  
  if(win.getParent().hwnd == $ie.hwnd) then
  
 #p $ie.hwnd, win.getParent().hwnd
  
 popupwin=win
  
 p "Found appropriate parent...Breaking"
  
 break
  
 end
  
 }
  
 p "Waiting for one sec for diaog to show up"
  
 sleep 1
  
 end
  
  
My break in the if condition, when I find if the child is indeed the
  
child of my ie window, is not working as expected.
  
  
Is this correct ruby usage?
  
Can anyone suggest any other way to retry my waiting mechanism or the
  
child dialog to appear which is spawned by my IE browser.
  
  
Thanks and Regards,
  
Manish
  



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

Re: [Wtr-general] Wtr-general Digest, Vol 33, Issue 19

2006-08-11 Thread Jeff Wood
Lonny Eachus wrote:

 Manish, your break is working. But it is breaking out of your code
 block, not your times loop.

 {|win|
  puts #{win.getClassName}\t#{win.getWindowText}
  #p win.getWindowRect
  #p win
  if(win.getParent().hwnd == $ie.hwnd) then
#p $ie.hwnd, win.getParent().hwnd
popupwin=win
p Found appropriate parent...Breaking
break
  end
}

 If I am not mistaken, this block amounts to an iterator controlled
 loop. So break will get you out of this block, but if you want out
 of your times loop, you will have to do break break.

 Lonny Eachus
 ==

 Subject:
 [Wtr-general] not exactly watir but a ruby question
 From:
 Manish Sapariya [EMAIL PROTECTED]
 Date:
 Fri, 11 Aug 2006 15:28:36 +0530


 Hi,
 How do break out of x.times loop.

 10.times do
  findWindowLike(nil, /^Microsoft Internet Explorer$/, //) {|win|
  puts #{win.getClassName}\t#{win.getWindowText}
  #p win.getWindowRect
  #p win
  if(win.getParent().hwnd == $ie.hwnd) then
#p $ie.hwnd, win.getParent().hwnd
popupwin=win
p Found appropriate parent...Breaking
break
  end
}
p Waiting for one sec for diaog to show up
sleep 1
end

 My break in the if condition, when I find if the child is indeed the
 child of my ie window, is not working as expected.

 Is this correct ruby usage?
 Can anyone suggest any other way to retry my waiting mechanism or the
 child dialog to appear which is spawned by my IE browser.

 Thanks and Regards,
 Manish
 

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

Or, you could use a simple throw-catch pair.

% irb
irb(main):001:0 catch :done do
irb(main):002:1*
irb(main):003:1*   10.times do |x|
irb(main):004:2*
irb(main):005:2*  [1,2,3].each do |y|
irb(main):006:3*throw :done if x == 4  y == 2
irb(main):007:3puts #{ x } : #{ y }
irb(main):008:3break if y == 2
irb(main):009:3  end
irb(main):010:2
irb(main):011:2*   end
irb(main):012:1
irb(main):013:1* end
0 : 1
0 : 2
1 : 1
1 : 2
2 : 1
2 : 2
3 : 1
3 : 2
4 : 1
= nil
irb(main):014:0


... so yeah, I didn't see the internal block the first time ... it will
only stop the most internal iterator ...

A throw-catch will bail to whatever level you define.

jd

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


[Wtr-general] Digest headers

2006-08-11 Thread Charley Baker
Just as a general reminder to the list. If you're getting the digest version, be careful about sending back the subject header, digest headers are useless in categorizing and threading the emails. The original subject header you're responding to is in the digest, ideally copy/paste that in place of the digest information. 
Thanks, Charley 

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

Re: [Wtr-general] Digest headers

2006-08-11 Thread Bret Pettichord
Charley Baker wrote:
 Just as a general reminder to the list. If you're getting the digest 
 version, be careful about sending back the subject header, digest 
 headers are useless in categorizing and threading the emails. The 
 original subject header you're responding to is in the digest, ideally 
 copy/paste that in place of the digest information.
I've spoken to Lonny about this before and suggested that we put him on 
moderate to help prevent him from doing it again. It totally screws up 
the thread.

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


Re: [Wtr-general] ie.back

2006-08-11 Thread Bret Pettichord
ie.back is tested in navigate_test.rb, which works for me in trunk. 
Aidy, does this test work for you?

Bret

Charley Baker wrote:
 Hey Aidy,

The back method does a straight call to ie's GoBack method, and 
 according to the comments throws that exception only if for some 
 reason it can't go back. If it is going back then you might want to 
 swallow the exception and add an assert for an element on the page 
 that you hoped to go back to. I don't see any inherent reason why it's 
 throwing the exception, but that's just from a quick look.

 -Charley

 On 8/10/06, *Adrian Lewis* [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:


 HI,

 The version of watir is shown in the err msg below. The browser is
 definitely going back to the previous HTML page, yet I
 receive this exception:

 c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1054 /./watir.rb:1500:in
 `method_missing': GoBack (WIN32OLERuntimeError)

 Should I catch the exception or choose a different method?

 (sorry if this has been briefed, but I cannot access the internet
 at the
 moment)

 Cheers

 Aidy


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


[Wtr-general] Accessed Denied in Nested Frames

2006-08-11 Thread Lonny Eachus





I have to deal with some pages that contain nested frames, with source
from different domains. Some are http and some https. In some cases,
while trying to access these frames, I get "access denied":

 irb(main):044:0 ie.show_frames
 there are 4 frames
 frame index: 1 name: header
 frame index: 2 name:
 frame index: 3 name: dtnav
 frame index: 4 Access Denied, see
http://wiki.openqa.org/display/WTR/FAQ#access-denied

I went to the website referenced in the message (nice touch, that) and
read up on this situation. I have tried the solutions listed that seem
practical in our situation, to no avail. For example, I have changed
the recommended security settings in IE. I dismissed aliases in the
Host file as being impractical for us: we would go nuts adding and
changing aliases on multiple machines all the time because there are
many pages, we are using multiple machines, and we are, after all, in
development.

I even went to the MS web page about this issue: Cross-Frame
Scripting and Security, and tried setting the domain from watir
(ie.document.domaiin = ) as they imply might work. No dice. That
command will let you broaden your domain, but the "access denied" pages
remain denied.

We might have a workaround, but that would require explicitly calling a
_javascript_ function from Ruby/Watir without having an event attached to
a page element. There has been some information here lately about
calling arbitrary _javascript_ functions, but when I checked my archive I
did not find a clear reference.

I would appreciate any insight into the "access denied" issue, and if
possible more information about how to call arbitrary _javascript_
functions without firing an event from a page element.

Thanks.

Lonny Eachus
==



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

Re: [Wtr-general] Accessed Denied in Nested Frames

2006-08-11 Thread Attebery, Bill



...if possible more
information about how to call arbitrary _javascript_ functions without firing an
event from a page element.

Here's oneway to call an
arbitrary java function that works like a charm for
me. 

window=$ie.ie.Document.parentWindowwindow.execScript('myjavafunction')

To give credit where credit is due, I found this on a
blog (which also has more details):
http://blogs.telerik.com/blogs/twisted_asp_net/archive/2006/04/26/201.aspx



The content contained in this electronic message is not intended to
constitute formation of a contract binding TWTC.  TWTC will be
contractually bound only upon execution, by an authorized officer, of
a contract including agreed terms and conditions or by express
application of its tariffs.

This message is intended only for the use of the individual or entity
to which it is addressed. If the reader of this message is not the
intended recipient, or the employee or agent responsible for
delivering the message to the intended recipient, you are hereby
notified that any dissemination, distribution or copying of this
message is strictly prohibited. If you have received this
communication in error, please notify us immediately by replying to
the sender of this E-Mail or by telephone.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Wtr-general Digest, Vol 33, Issue 19

2006-08-11 Thread Manish Sapariya
Thanks,
It did work.
Regards,
Manish



Jeff Wood wrote:
 Or, you could use a simple throw-catch pair.

 % irb
 irb(main):001:0 catch :done do
 irb(main):002:1*
 irb(main):003:1*   10.times do |x|
 irb(main):004:2*
 irb(main):005:2*  [1,2,3].each do |y|
 irb(main):006:3*throw :done if x == 4  y == 2
 irb(main):007:3puts #{ x } : #{ y }
 irb(main):008:3break if y == 2
 irb(main):009:3  end
 irb(main):010:2
 irb(main):011:2*   end
 irb(main):012:1
 irb(main):013:1* end
 0 : 1
 0 : 2
 1 : 1
 1 : 2
 2 : 1
 2 : 2
 3 : 1
 3 : 2
 4 : 1
 = nil
 irb(main):014:0


 ... so yeah, I didn't see the internal block the first time ... it will
 only stop the most internal iterator ...

 A throw-catch will bail to whatever level you define.

 jd

 ___
 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