Re: [Wtr-general] Everyday Scripting with Ruby (the book)
Hi Željko, I was also a reviewer and I live in the UK. Daniel sent me a copy about two months ago. I'd guess yours got lost in the post. George Hawthorne On 10 Apr 2007, at 08:45, Željko Filipin wrote: I was reviewer, and over two months ago I received an e-mail from Daniel Steinberg (Pragmatic Programmers) saying that if I send them my mailing address they would send me a free copy. I replied with my mailing address, but the book did not arrive. I even sent him a reminder two weeks ago. No reply. Maybe there is a problem because I am from Europe (but I already received mail from US). Did anybody had a similar experience? Zeljko -- ZeljkoFilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Using watir to control JavaScript popups
On 13/11/06, Garry West [EMAIL PROTECTED] wrote: I am new to watir and I am currently trying to automate some tests, however I am having difficulties automating a JavaScript popup. This popup asks the user to confirm that they would like to log off, it has two options which are OK and Cancel. After reading some information from various web pages it would appear that this is a difficult thing to do... Any suggestions how to do this? Garry West Hi Garry, Good to see another UK person using Watir (I'm in Brighton). Reliability used to be a problem but I'm now using Watir to test a web app that has loads of JavaScript pop-ups. The method described below is an unofficial add-on rather than a supported part of Watir but it works fine. Get the latest development version of Watir (1127 as of a few moments ago). Then use the following code... # The next line goes with the other require statements at the top of your script require 'watir/contrib/enabled_popup' ... # The next statement clicks the link or button that produces your pop-up - amend it as appropriate. ie.link(:text, yourlink).click_no_wait # Now comes the code that handles the pop-up. No need to change it unless you want to click the 'Cancel' button rather than OK 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 If you have problems post again or email me. George ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] WinClicker - too many callbacks are defined
Resending with missing error message added... Hi, The application I'm testing uses lots of modal Javascript alerts with 'OK' and 'Cancel' buttons. I'm using WinClicker to handle them and it works very nicely until you get to the 11th pop-up, at which point it throws the error: DL::DLError: too many callbacks are defined. Watir version is 1.5.1.1119 and IE version is 7. Details are below. I'd be grateful for any thoughts. Here's a test that consistently produces the error. It always works perfectly for the first 10 instances and then fails on the 11th instance... def test001 1.upto 20 do |i| puts i.to_s # add an object $ie.button(:id, addrow).click # delete the object $ie.button(:id, deleterow).click_no_wait # this throws up a Javascript alert # click OK on the pop-up hwnd = $ie.enabled_popup(5) # get a handle if one exists if (hwnd) w = WinClicker.new w.makeWindowActive(hwnd) w.clickWindowsButton_hwnd(hwnd, OK) end $ie.wait end end Here's the output... Started 1 2 3 4 5 6 7 8 9 10 11 E Finished in 38.226 seconds. 1) Error: test001(PMtest): DL::DLError: too many callbacks are defined. C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1119/./watir/winClicker.rb:308:in `callback' C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1119/./watir/winClicker.rb:308:in `getChildHandle' C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1119/./watir/winClicker.rb:254:in `clickWindowsButton_hwnd' C:/eclipse/workspace/PM_tests/trial3.rb:113:in `test001' C:/eclipse/workspace/PM_tests/trial3.rb:100:in `upto' C:/eclipse/workspace/PM_tests/trial3.rb:100:in `test001' Thanks, George ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] WinClicker - too many callbacks are defined
Hi, The application I'm testing uses lots of modal Javascript alerts with 'OK' and 'Cancel' buttons. I'm using WinClicker to handle them and it works very nicely until you get to the 11th pop-up, at which point it throws the error: DL::DLError: too many callbacks are defined. Watir version is 1.5.1.1119 and IE version is 7. Details are below. I'd be grateful for any thoughts. Here's a test that consistently produces the error. It always works perfectly for the first 10 instances and then fails on the 11th instance... def test001 1.upto 20 do |i| puts i.to_s # add an object $ie.button(:id, addrow).click # delete the object $ie.button(:id, deleterow).click_no_wait # this throws up a Javascript alert # click OK on the pop-up hwnd = $ie.enabled_popup(5) # get a handle if one exists if (hwnd) w = WinClicker.new w.makeWindowActive(hwnd) w.clickWindowsButton_hwnd(hwnd, OK) end $ie.wait end end Here's the output... Started 1 2 3 4 5 6 7 8 9 10 11 E Finished in 38.226 seconds. Thanks, George ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] WinClicker - too many callbacks are defined
Thanks for the suggestions. I tried both but got exactly the same error. On 27/10/06, Cain, Mark [EMAIL PROTECTED] wrote: This is a shot in the dark but did you try explicitly setting the WinClicker object w to nil after the popup is dismissed? ... if (hwnd) w = WinClicker.new w.makeWindowActive(hwnd) w.clickWindowsButton_hwnd(hwnd, OK) w = nil end ... OR You could create the WinClicker object when the test is initialized and reuse that object throughout. --Mark -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of George Hawthorne Sent: Friday, October 27, 2006 6:07 AM To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] WinClicker - too many callbacks are defined Resending with missing error message added... Hi, The application I'm testing uses lots of modal Javascript alerts with 'OK' and 'Cancel' buttons. I'm using WinClicker to handle them and it works very nicely until you get to the 11th pop-up, at which point it throws the error: DL::DLError: too many callbacks are defined. Watir version is 1.5.1.1119 and IE version is 7. Details are below. I'd be grateful for any thoughts. Here's a test that consistently produces the error. It always works perfectly for the first 10 instances and then fails on the 11th instance... def test001 1.upto 20 do |i| puts i.to_s # add an object $ie.button(:id, addrow).click # delete the object $ie.button(:id, deleterow).click_no_wait # this throws up a Javascript alert # click OK on the pop-up hwnd = $ie.enabled_popup(5) # get a handle if one exists if (hwnd) w = WinClicker.new w.makeWindowActive(hwnd) w.clickWindowsButton_hwnd(hwnd, OK) end $ie.wait end end Here's the output... Started 1 2 3 4 5 6 7 8 9 10 11 E Finished in 38.226 seconds. 1) Error: test001(PMtest): DL::DLError: too many callbacks are defined. C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1119/./watir/winClicker.rb:30 8:in `callback' C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1119/./watir/winClicker.rb:30 8:in `getChildHandle' C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1119/./watir/winClicker.rb:25 4:in `clickWindowsButton_hwnd' C:/eclipse/workspace/PM_tests/trial3.rb:113:in `test001' C:/eclipse/workspace/PM_tests/trial3.rb:100:in `upto' C:/eclipse/workspace/PM_tests/trial3.rb:100:in `test001' Thanks, George ___ 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 mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Tricky select list
Thanks Mark and David. That works fine. I hadn't thought to use :index on a selectlist. George On 17/05/06, Cain, Mark [EMAIL PROTECTED] wrote: Did you try: #doesn't appear that your select_list has a name or id given so you will #have to find the index-it will be the nth one from the top of the page #using view source. $ie.select_list(:index, 1).select_value('0') or $ie.select_list(:index, 1).select('All') --Mark ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Tricky select list
Hi, Could anyone suggest the correct way to select option 0 from the list shown in the following HTML example? By default option 1 is selected and I can't figure out how to get WATIR to change the selection. TIA. input type=hidden name=people$hSelectId id=people_hSelectId / div id=people_divXtable class=genTable style=width:480px; div id=divXTableD style='width:480px' div class='mainGenDiv' style='overflow:hidden;' table tr class='header' td div style='width:62px;' a href=javascript:OnSort('D',0);First Name/aimg src='img/filterup_off.gif'/img src='img/filterdown_on.gif'/br / select onchange=OnFilter('D',0,this); style='width:54px;' option value=0All/option option selected='selected' value=1Assigned/option option value=2A/option option value=3B/option option value=4C/option option value=5D/option ... /select /div /td George ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Ruby and Watir version from IRB
Hi Guru, Nice to finally come across a question on this list that I can answer... irb(main):002:0 require watir irb(main):003:0 Watir::IE::VERSION irb(main):004:0 print `ruby --version` George On 01/04/06, Guru Subramanyam [EMAIL PROTECTED] wrote: Hi, Is there a way to find out the version of Ruby and Watir from within the IRB? Thanks Guru ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] click_no_wait with divs
Hi, The app I'm testing has lots of Javascript pop-ups. The method used for clicking them in the dialog_test.rb unit test works in some cases, as in: $ie.link( :text, Delete contact).click_no_wait # click OK or cancel pop-up appears assert dialog.exists? dialog.button('OK').click # OK button on pop-up is successfully clicked But when I try it on a button in a div, as in the following code, I get an undefined method error. # the delete button is in a div $ie.div(:id, 'divXdatat').button(:index,1).click_no_wait assert dialog.exists? dialog.button('OK').click produces: NoMethodError: undefined method `eval_in_spawned_process' for #Watir::Div:0x2bfff00 c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2264:in `click_no_wait' Does anyone know of a solution or workaround for this? If I change the 'click_no_wait' to a 'click' the pop-up appears but I can't close it. I've tried Winclicker but it is unreliable. I'm using Watir version 1.5.0.934. Thanks for any suggestions, George ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] AjaxMethod pop-up
I'm testing a page that has a list of items in table. You can click on an icon to delete one of the items. This uses an onclick event - onclick=javascript:return ConfirmX('t',977); - which calls the function below. The function produces a popup with OK and Cancel buttons. function ConfirmX(list,id) { if (confirm(Are you sure you want to delete this item?)) AjaxMethod.OnDelete(list,id,RepaintDataCallback); return false; } I've tried all the usual methods, as per FAQ and Unit Tests, to click OK on the popup but nothing works. I don't get an error message - the popup just sits there until I manually close it. Can anyone suggest a solution? Thanks, George ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general