Re: [Wtr-general] Javascript Alert windows

2006-10-28 Thread atul prakash
hello
 
this is atul.
first of all find the logical name of that perticuler button.
let if u are working on browser,then do right click on that perticular browser on which that perticular button exists.
and then find the logical name ok that button.
then use this " ie.button(:name, "put name of that button here").click "
thanks. 
On 10/27/06, Dave Munns <[EMAIL PROTECTED]> wrote:
Sometimes one just stumbles into a solution.ie.table(:index,1)[5][1].button(:id,'imgFinishButton').click
For some reason I had to use button instead of image, even though the html indicated it was an image!-Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4669&messageID=13908#13908___Wtr-general mailing listWtr-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] Javascript Alert windows

2006-10-27 Thread Dave Munns
Sometimes one just stumbles into a solution. 

ie.table(:index,1)[5][1].button(:id,'imgFinishButton').click

For some reason I had to use button instead of image, even though the html 
indicated it was an image!
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4669&messageID=13908#13908
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Javascript Alert windows

2006-10-27 Thread Dave Munns
I tried method 1 and method 2, with no success. I am using Watir 1.5 to support 
modal dialogs. Using irb I can access certain portions of the Javascript alert 
window, such as the title (I attach to the window by title) and 3 text areas 
that are DIV areas. The window has 2 buttons at the bottom. I want to click on 
the CLOSE button.  I have tried accessing the button as follows:

ie.table(:index,1)[5].image(:id,'imgFinishButton').flash 

The button is defined outside of a SPAN or DIV but is within a TABLE.
Here is the html that contains that button (id='imgFinishButton'):

irb> ie.table(:index,1)[5].html

=> "\r\n http://qlwdmunns2k3/ecm4/L103
3/images/imgHelpButton.gif\" align=left border=0 udefDisabled=\"false\"> 
\r\n  
http://qlwdmunns2k3/ecm4/L1033/images/imgBackButtonDi
sabled.gif\" border=0 udefDisabled=\"true\" udefACCESSKEY=\"2\">  http://qlwdmunns2
k3/ecm4/L1033/images/imgNextButtonDisabled.gif\" border=0 udefDisabled=\"true\" 
udefACCESSKEY=\"14\">  
http://qlwdmunns2k3/ecm4/L1033/images/imgCloseButton.gif\"; border=0 
udefDisabled=\"false\">  
"
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4669&messageID=13906#13906
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Javascript Alert windows - include Win32

2006-10-10 Thread Sun
Putting in: 
==
include Win32 
==
without quotation marks, above the:
==
def enabled_popup(timeout=4)
==
is indeed the fix.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4715&messageID=13079#13079
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Javascript Alert windows

2006-10-09 Thread Bret Pettichord

> I submitted this bug: http://jira.openqa.org/browse/WTR-112 
> 
Thank you. I've committed the fix. You can either build your own gem 
from trunk or else wait for the next development gem (in say the next 
week) to confirm.
> Would you be interested in unit tests for this module? I am not 
> confident of my ruby skills at this point, but that might be a good 
> exercise for me and possibly helpful to you?
That would be awesome. I've been thinking of writing up guidelines on 
how to write Watir Unit tests, and certainly am willing to help if you 
have questions about this.

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


Re: [Wtr-general] Javascript Alert windows

2006-10-09 Thread Bret Pettichord
I committed this change as recommended. Thanks Matt, Mark and David.
http://svn.openqa.org/fisheye/changelog/watir/?cs=1115

Bret

Matt Johnson wrote:
> Thank you, adding include Win32 worked.
>
> -- MattJ
>
> On 10/9/06, *Cain, Mark* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> 
> wrote:
>
> You could also just put "include Win32" right above the
> "def enabled_popup(timeout=4)" in /watir/contrib/enabled_popup.rb
>
> --Mark
>
> -Original Message-
> From: [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> [mailto:[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>] On Behalf Of David Schmidt
> Sent: Saturday, October 07, 2006 7:07 PM
> To: wtr-general@rubyforge.org <mailto:wtr-general@rubyforge.org>;
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> Subject: Re: [Wtr-general] Javascript Alert windows
>
> Matt,
>
> The problem is that when the enabled_popup method was removed from
> watir.rb the definitions for GetWindows() definition wasn't moved with
> it.  Afterwards, the definition for GetWindows was moved in the
> watir.rb
>
> file so that it is no longer found by enabled_popup.
>
> If you look in the watir.rb file for GetWindow and move those
> definitions into the enabled_popup.rb file then it should work fine.
>
> David Schmidt
>
>
> -- 
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> 
>
> ___
> 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] Javascript Alert windows

2006-10-09 Thread Matt Johnson
Hi, I understood that this was unsupported ( and undocumented ) code. I appreciate the help getting this to work. I submitted this bug: http://jira.openqa.org/browse/WTR-112
The fix seems simple.Would you be interested in unit tests for this module? I am not confident of my ruby skills at this point, but that might be a good exercise for me and possibly helpful to you?
-- MattJOn 10/8/06, Bret Pettichord <[EMAIL PROTECTED]> wrote:
Looks like this may be a bug. Please report this in Jira. It would alsohelp if you would report what  C:/ruby/mattj/scanmus/scanmus3.rb:79looks like.The code you are using does not have have unit tests and is currently
unsupported.Bret___Wtr-general mailing listWtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general-- MattJ[EMAIL PROTECTED] 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Javascript Alert windows

2006-10-09 Thread Matt Johnson
Thank you, adding include Win32 worked. -- MattJOn 10/9/06, Cain, Mark <[EMAIL PROTECTED]> wrote:

You could also just put "include Win32" right above the"def enabled_popup(timeout=4)" in /watir/contrib/enabled_popup.rb--Mark-Original Message-From: 
[EMAIL PROTECTED][mailto:[EMAIL PROTECTED]] On Behalf Of David SchmidtSent: Saturday, October 07, 2006 7:07 PMTo: 
wtr-general@rubyforge.org; [EMAIL PROTECTED]Subject: Re: [Wtr-general] _javascript_ Alert windowsMatt,The problem is that when the enabled_popup method was removed from
watir.rb the definitions for GetWindows() definition wasn't moved withit.  Afterwards, the definition for GetWindows was moved in the watir.rbfile so that it is no longer found by enabled_popup.If you look in the 
watir.rb file for GetWindow and move thosedefinitions into the enabled_popup.rb file then it should work fine.David Schmidt-- [EMAIL PROTECTED]
 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Javascript Alert windows

2006-10-09 Thread Bret Pettichord
Matt Johnson wrote:
> Hello,
> I have been trying to use the second method described above with no 
> success. I am trying to clear a security dialog that appears after 
> clicking a "Sign In" button. I can see that the button gets clicked, 
> then the script blocks. If I kill the script ( by closing the browser, 
> or whatever ) I get this error message:
>
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir/contrib/enabled_popup.rb:10:in
>  
> `enabled_popup': uninitialized constant 
> Watir::PageContainer::GetWindow (NameError)
> from c:/ruby/lib/ruby/gems/1.8/gems/watir- 
> 1.5.1.1100/./watir/contrib/enabled_popup.rb:9:in `until_with_timeout'
> from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir.rb:210:in 
> `wait_until'
> from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir.rb:210:in 
> `until_with_timeout'
> from 
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir/contrib/enabled_popup.rb:9:in
>  
> `enabled_popup'
> from C:/ruby/mattj/scanmus/scanmus3.rb:79
>
> Can anyone tell me what the problem is, or how I can debug this 
> further? Why is this not initialized? Does that mean I have some kind 
> of path or other environment problem. I am using WinXP SP2, ruby 1.8.2 
> (2004-12-25) [i386-mswin32], watir 1.5.1.1100.
Looks like this may be a bug. Please report this in Jira. It would also 
help if you would report what  C:/ruby/mattj/scanmus/scanmus3.rb:79 
looks like.

The code you are using does not have have unit tests and is currently 
unsupported.

Bret

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


Re: [Wtr-general] Javascript Alert windows

2006-10-09 Thread Cain, Mark
You could also just put "include Win32" right above the 
"def enabled_popup(timeout=4)" in /watir/contrib/enabled_popup.rb

--Mark

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Schmidt
Sent: Saturday, October 07, 2006 7:07 PM
To: wtr-general@rubyforge.org; [EMAIL PROTECTED]
Subject: Re: [Wtr-general] Javascript Alert windows

Matt,

The problem is that when the enabled_popup method was removed from 
watir.rb the definitions for GetWindows() definition wasn't moved with 
it.  Afterwards, the definition for GetWindows was moved in the watir.rb

file so that it is no longer found by enabled_popup.

If you look in the watir.rb file for GetWindow and move those 
definitions into the enabled_popup.rb file then it should work fine.

David Schmidt

Matt Johnson wrote:
>
>
> On 10/5/06, *Cain, Mark* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> 
> wrote:
>
> The JavaScript Alert, Confirm, Prompt, Security, File Save, File
> Download, File Upload, error message, and login (I think this is a
> complete list but there may be others) are all a special type of
> modal popup dialog window-there isn't a different one.   In order
> to handle these types of popups you have to start another thread
> independent of your $ie thread OR you have to not block the
> process by using click_no_wait.
>
> There are two ways (that actually both use the WInClicker).  The
> first one is listed below that works with the older versions of
> Watir.  The second (I have found after using them both) is more
> reliable than the first but require you having a Watir version
> greater than 1079 because of some fixes to click_no_wait (can't
> remember the exact version).  You can get them here: 
> http://wiki.openqa.org/display/WTR/Development+Builds
>
>  
>
> *_First method (works with Watir 1.4.x):_*
>
> def jsAlert(button, waitTime = 3)
>  w = WinClicker.new
>  longName = $ie.dir.gsub("/" , "\\" )
>  shortName = w.getShortFileName(longName)
>  c = "start ruby #{shortName}\\watir\\clickJSDialog.rb
> #{button} #{waitTime} "
>  puts "Starting #{c}"
>  w.winsystem(c)
>  w=nil
> end
>
>  
>
> Then, before the button you want to click that generates the
> popup, add in:
>
> jsAlert("OK", 3)
>
> ie.button(:name, "woohoo").click # This is the button you want
> to click that generates the popup
>
>  
>
> *_Second Method (faster and more reliable):_ *
>
> require 'watir\contrib\enabled_popup'
>
>  
>
> 
>
>  
>
> $ie.button("Button Label Text").click_no_wait
>
>  
>
> # use click_no_wait to click the button that invokes the JS Alert
> $ie.button.click_no_wait
>
>  
>
> hwnd = ie.enabled_popup (5)   # get a handle if one
> exists
>
> if (hwnd) # yes there is a popup
>
>   w = WinClicker.new
>
>  w.makeWindowActive(hwnd)
>
> # "OK" or whatever the name on the button is
>
>   w.clickWindowsButton_hwnd(hwnd, "OK")   
>
> end
>
>  
>
> NOTE:  If you are using IE7 then the title on the JS Alert box is
> different then IE6+ so you will need to alter you WinClicker.rb
> file for either method.
>
> \ruby\lib\ruby\site_ruby\1.8\watir\WinClicker.rb Lines 113 and
144.
>
> IE6 = "Microsoft Internet Explorer"
>
> IE7 = "Windows Internet Explorer"
>
>  
>
> Hope this helps,
>
>  
>
> *--Mark*
>
>
> ___
> Wtr-general mailing list
> Wtr-general@rubyforge.org <mailto:Wtr-general@rubyforge.org>
> http://rubyforge.org/mailman/listinfo/wtr-general
>
>
> Hello,
> I have been trying to use the second method described above with no 
> success. I am trying to clear a security dialog that appears after 
> clicking a "Sign In" button. I can see that the button gets clicked, 
> then the script blocks. If I kill the script ( by closing the browser,

> or whatever ) I get this error message:
>
>
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir/contrib/enabled_
popup.rb:10:in 
> `enabled_popup': uninitialized constant 
> Watir::PageContainer::GetWindow (NameError)
> from c:/ruby/lib/ruby/gems/1.8/gems/watir- 
> 1.5.1.1100/./watir/contrib/enabled_popup.rb:9:in `until_with_timeout'
> from c:/ruby/l

Re: [Wtr-general] Javascript Alert windows

2006-10-09 Thread David Schmidt
Matt,

The problem is that when the enabled_popup method was removed from 
watir.rb the definitions for GetWindows() definition wasn't moved with 
it.  Afterwards, the definition for GetWindows was moved in the watir.rb 
file so that it is no longer found by enabled_popup.

If you look in the watir.rb file for GetWindow and move those 
definitions into the enabled_popup.rb file then it should work fine.

David Schmidt

Matt Johnson wrote:
>
>
> On 10/5/06, *Cain, Mark* <[EMAIL PROTECTED] > 
> wrote:
>
> The JavaScript Alert, Confirm, Prompt, Security, File Save, File
> Download, File Upload, error message, and login (I think this is a
> complete list but there may be others) are all a special type of
> modal popup dialog window—there isn't a different one.   In order
> to handle these types of popups you have to start another thread
> independent of your $ie thread OR you have to not block the
> process by using click_no_wait.
>
> There are two ways (that actually both use the WInClicker).  The
> first one is listed below that works with the older versions of
> Watir.  The second (I have found after using them both) is more
> reliable than the first but require you having a Watir version
> greater than 1079 because of some fixes to click_no_wait (can't
> remember the exact version).  You can get them here: 
> http://wiki.openqa.org/display/WTR/Development+Builds
>
>  
>
> *_First method (works with Watir 1.4.x):_*
>
> def jsAlert(button, waitTime = 3)
>  w = WinClicker.new
>  longName = $ie.dir.gsub("/" , "\\" )
>  shortName = w.getShortFileName(longName)
>  c = "start ruby #{shortName}\\watir\\clickJSDialog.rb
> #{button} #{waitTime} "
>  puts "Starting #{c}"
>  w.winsystem(c)
>  w=nil
> end
>
>  
>
> Then, before the button you want to click that generates the
> popup, add in:
>
> jsAlert("OK", 3)
>
> ie.button(:name, "woohoo").click # This is the button you want
> to click that generates the popup
>
>  
>
> *_Second Method (faster and more reliable):_ *
>
> require 'watir\contrib\enabled_popup'
>
>  
>
> 
>
>  
>
> $ie.button("Button Label Text").click_no_wait
>
>  
>
> # use click_no_wait to click the button that invokes the JS Alert
> $ie.button.click_no_wait
>
>  
>
> hwnd = ie.enabled_popup (5)   # get a handle if one
> exists
>
> if (hwnd) # yes there is a popup
>
>   w = WinClicker.new
>
>  w.makeWindowActive(hwnd)
>
> # "OK" or whatever the name on the button is
>
>   w.clickWindowsButton_hwnd(hwnd, "OK")   
>
> end
>
>  
>
> NOTE:  If you are using IE7 then the title on the JS Alert box is
> different then IE6+ so you will need to alter you WinClicker.rb
> file for either method.
>
> \ruby\lib\ruby\site_ruby\1.8\watir\WinClicker.rb Lines 113 and 144.
>
> IE6 = "Microsoft Internet Explorer"
>
> IE7 = "Windows Internet Explorer"
>
>  
>
> Hope this helps,
>
>  
>
> *--Mark*
>
>
> ___
> Wtr-general mailing list
> Wtr-general@rubyforge.org 
> http://rubyforge.org/mailman/listinfo/wtr-general
>
>
> Hello,
> I have been trying to use the second method described above with no 
> success. I am trying to clear a security dialog that appears after 
> clicking a "Sign In" button. I can see that the button gets clicked, 
> then the script blocks. If I kill the script ( by closing the browser, 
> or whatever ) I get this error message:
>
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir/contrib/enabled_popup.rb:10:in
>  
> `enabled_popup': uninitialized constant 
> Watir::PageContainer::GetWindow (NameError)
> from c:/ruby/lib/ruby/gems/1.8/gems/watir- 
> 1.5.1.1100/./watir/contrib/enabled_popup.rb:9:in `until_with_timeout'
> from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir.rb:210:in 
> `wait_until'
> from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir.rb:210:in 
> `until_with_timeout'
> from 
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir/contrib/enabled_popup.rb:9:in
>  
> `enabled_popup'
> from C:/ruby/mattj/scanmus/scanmus3.rb:79
>
> Can anyone tell me what the problem is, or how I can debug this 
> further? Why is this not initialized? Does that mean I have some kind 
> of path or other environment problem. I am using WinXP SP2, ruby 1.8.2 
> (2004-12-25) [i386-mswin32], watir 1.5.1.1100.
>
> Thanks in advance.
>
> --
> MattJ
> [EMAIL PROTECTED] 

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


Re: [Wtr-general] Javascript Alert windows

2006-10-06 Thread Matt Johnson
On 10/5/06, Cain, Mark <[EMAIL PROTECTED]> wrote:
The _javascript_ Alert, Confirm, Prompt, Security, File Save, File Download, File Upload, error message, and login (I think this is a complete list but there may be others) are all a special type of modal popup dialog window—there isn't a different one.   In order to handle these types of popups you have to start another thread independent of your $ie thread OR you have to not block the process by using click_no_wait.
There are two ways (that actually both use the WInClicker).  The first one is listed below that works with the older versions of Watir.  The second (I have found after using them both) is more reliable than the first but require you having a Watir version greater than 1079 because of some fixes to click_no_wait (can't remember the exact version).  You can get them here:  
http://wiki.openqa.org/display/WTR/Development+Builds 
 
First method (works with Watir 1.4.x):def jsAlert(button, waitTime = 3)  w = 
WinClicker.new  longName = $ie.dir.gsub("/" , "\\" )  shortName = w.getShortFileName(longName)  c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button} #{waitTime} "
  puts "Starting #{c}"  w.winsystem(c)  w=nil end 
Then, before the button you want to click that generates the popup, add in:
jsAlert("OK", 3)ie.button(:name, "woohoo").click
    # This is the button you want to click that generates the popup
 Second Method (faster and more reliable):
require 'watir\contrib\enabled_popup'
 
 $ie.button("Button Label Text").click_no_wait
 # use click_no_wait to click the button that invokes the JS Alert $ie.button.click_no_wait
 hwnd = ie.enabled_popup
(5)   # get a handle if one exists
if (hwnd)    
# yes there is a popup
  w = WinClicker.new
     w.makeWindowActive(hwnd)# "OK" or whatever the name on the button is
  w.clickWindowsButton_hwnd(hwnd, "OK")    
end 
NOTE:  If you are using IE7 then the title on the JS Alert box is different then IE6+ so you will need to alter you 
WinClicker.rb file for either method.\ruby\lib\ruby\site_ruby\1.8\watir\WinClicker.rb Lines 113 and 144.
IE6 = "Microsoft Internet Explorer"
IE7 = "Windows Internet Explorer"
 Hope this helps,
 
--Mark___Wtr-general mailing list
Wtr-general@rubyforge.orghttp://rubyforge.org/mailman/listinfo/wtr-general
Hello,I have been trying to use the second method described above with no success. I am trying to clear a security dialog that appears after clicking a "Sign In" button. I can see that the button gets clicked, then the script blocks. If I kill the script ( by closing the browser, or whatever ) I get this error message:
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir/contrib/enabled_popup.rb:10:in `enabled_popup': uninitialized constant Watir::PageContainer::GetWindow (NameError)	from c:/ruby/lib/ruby/gems/1.8/gems/watir-
1.5.1.1100/./watir/contrib/enabled_popup.rb:9:in `until_with_timeout'	from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir.rb:210:in `wait_until'	from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir.rb:210:in `until_with_timeout'
	from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir/contrib/enabled_popup.rb:9:in `enabled_popup'	from C:/ruby/mattj/scanmus/scanmus3.rb:79Can anyone tell me what the problem is, or how I can debug this further? Why is this not initialized? Does that mean I have some kind of path or other environment problem. I am using WinXP SP2, ruby 
1.8.2 (2004-12-25) [i386-mswin32], watir 1.5.1.1100.Thanks in advance.-- MattJ[EMAIL PROTECTED] 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Javascript Alert windows

2006-10-05 Thread Cain, Mark








The _javascript_ Alert, Confirm, Prompt,
Security, File Save, File Download, File Upload, error message, and login (I think
this is a complete list but there may be others) are all a special type of
modal popup dialog window—there isn’t a different one.   In
order to handle these types of popups you have to start another thread independent
of your $ie thread OR you have to not block the process by using click_no_wait.

There are two ways (that actually both use
the WInClicker).  The first one is listed below that works with the older
versions of Watir.  The second (I have found after using them both) is
more reliable than the first but require you having a Watir version greater
than 1079 because of some fixes to click_no_wait (can’t remember the
exact version).  You can get them here:  http://wiki.openqa.org/display/WTR/Development+Builds


 

First
method (works with Watir 1.4.x):

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

 

Then, before the button you want to click
that generates the popup, add in:

jsAlert("OK", 3)

ie.button(:name,
"woohoo").click    # This
is the button you want to click that generates the popup

 

Second
Method (faster and more reliable):

require 'watir\contrib\enabled_popup'

 



 

$ie.button(“Button Label Text”).click_no_wait

 

# use click_no_wait to click the button
that invokes the JS Alert $ie.button.click_no_wait

 

hwnd =
ie.enabled_popup(5) 
 # get a handle if one exists

if (hwnd)
   # yes there is a popup

  w =
WinClicker.new

     w.makeWindowActive(hwnd)

#
"OK" or whatever the name on the button is

  w.clickWindowsButton_hwnd(hwnd,
"OK")    

end

 

NOTE:  If you are using IE7 then the title
on the JS Alert box is different then IE6+ so you will need to alter you WinClicker.rb
file for either method.

\ruby\lib\ruby\site_ruby\1.8\watir\WinClicker.rb
Lines 113 and 144.

IE6 = "Microsoft
Internet Explorer"

IE7 = "Windows
Internet Explorer"

 

Hope this helps,

 





--Mark










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

Re: [Wtr-general] Javascript Alert windows

2006-10-04 Thread David Munns








Clever code. My problem is slightly
different. I am testing a product that uses a web based GUI, by navigating to
all GUI controls and collecting data for validation comparisons. This product
generates the _javascript_ alert windows to kindly prompt the user that some
action has been completed. They lock up the screen until something clicks the
OK button on the _javascript_ alert window. I want to code the OK button click
for this window, which was opened by the product. 

 









From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Adam Reed
Sent: Wednesday, October 04, 2006
1:40 PM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general]
_javascript_ Alert windows



 

David,

 

    I remember this being
in the FAQ and forum posts, but I haven't been in a while -- maybe it was
removed (I can't check at the moment).  First you define your script that
closes the window (I called it jsAlert).

 

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

 

Then, before the button you want to click
that generates the popup, add in:

jsAlert("OK", 3)

ie.button(:name,
"woohoo").click    # This
is the button you want to click that generates the popup



 





Thanks,





 





Adam Reed





RelocationCentral by CORT









From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of David Munns
Sent: Wednesday, October 04, 2006
12:19 PM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] _javascript_
Alert windows

Does Watir have a way of processing _javascript_ Alert
windows, by clicking the OK button to dismiss the window? The code that invokes
the window issues an alert call with no window handle. I did not find anything
on this in the online docs or in the email dist.






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

Re: [Wtr-general] Javascript Alert windows

2006-10-04 Thread Cain, Mark
Try this:

require 'watir\contrib\enabled_popup'




# use click_no_wait to click the button that invokes the JS Alert
$ie.button.click_no_wait

hwnd = ie.enabled_popup(5)   # get a handle if one exists
if (hwnd)# yes there is a popup
  w = WinClicker.new
  w.makeWindowActive(hwnd)
# "OK" or whatever the name on the button is
  w.clickWindowsButton_hwnd(hwnd, "OK")
end

--Mark


From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Munns
Sent: Wednesday, October 04, 2006 10:19 AM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] Javascript Alert windows

Does Watir have a way of processing Javascript Alert windows, by
clicking the OK button to dismiss the window? The code that invokes the
window issues an alert call with no window handle. I did not find
anything on this in the online docs or in the email dist.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Javascript Alert windows

2006-10-04 Thread Adam Reed



David,
 
    I remember this being in the FAQ and 
forum posts, but I haven't been in a while -- maybe it was removed (I can't 
check at the moment).  First you define your script that closes the window 
(I called it jsAlert).
 
def jsAlert(button, waitTime 
= 3) w = 
WinClicker.new longName = 
$ie.dir.gsub("/" , "\\" ) shortName = 
w.getShortFileName(longName) c = "start ruby 
#{shortName}\\watir\\clickJSDialog.rb #{button} #{waitTime} " puts "Starting 
#{c}" w.winsystem(c) w=nilend
 
Then, before the button you want to click that 
generates the popup, add in:
jsAlert("OK", 3)
ie.button(:name, 
"woohoo").click    # This is the button you want to click 
that generates the popup
 
Thanks,
 
Adam 
Reed
RelocationCentral 
by CORT


From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of David 
MunnsSent: Wednesday, October 04, 2006 12:19 PMTo: 
wtr-general@rubyforge.orgSubject: [Wtr-general] _javascript_ Alert 
windows


Does Watir have a way of processing 
_javascript_ Alert windows, by clicking the OK button to dismiss the window? The 
code that invokes the window issues an alert call with no window handle. I did 
not find anything on this in the online docs or in the email 
dist.
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] Javascript Alert windows

2006-10-04 Thread David Munns








Does Watir have a way of processing _javascript_ Alert windows,
by clicking the OK button to dismiss the window? The code that invokes the
window issues an alert call with no window handle. I did not find anything on
this in the online docs or in the email dist.






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