[wtr-general] Re: button.Click_No_Wait only highlights the button, does not click
Thank you for your code. I test it. But Click_no_wait still cannot work. The result shows There's no popup. Here is the code I used to test. I changed your code to get it. require 'watir' require 'watir/ie'# require 'watir\contrib\enabled_popup' #fafdfs require 'watir/dialog'#fafsfasd require 'watir/winClicker'#fasfsdfa require 'thread' def test_001_Login $batchCode=0 # attach a new browser window $ie = Watir::IE.attach(:url,about:blank) Watir::IE.attach_timeout = 10 $ie.goto('http://www.w3schools.com/js/tryit_view.asp? filename=tryjs_alert') # This website only has an alert button, you can test using this website. $ie.button(:index,1).click_no_wait begin hwnd = $ie.enabled_popup(5) if(hwnd) popup = WinClicker.new popup.makeWindowActive(hwnd) #Activate the window. popup.clickWindowsButton_hwnd(hwnd,OK) #Click the OK button end rescue = e puts e puts There is no popup end end test_001_Login Can you try it and see whether it can work in your computer? Thanks a lot. On Dec 12, 10:15 pm, pramod D petkar.pra...@gmail.com wrote: I am posting a sample code which i am using in my script *def test_001_Login $batchCode=0 # attach a new browser window $ie = Watir::IE.attach(:url,about:blank) Watir::IE.attach_timeout = 10.0 ... ... $ie.frame(mains).image(:index,1).click_no_wait begin hwnd = $ie.enabled_popup(5) if(hwnd) popup = WinClicker.new popup.makeWindowActive(hwnd) #Activate the window. popup.clickWindowsButton_hwnd(hwnd,OK) #Click the OK button end rescue = e puts e puts There is no popup end def test_005_logout $ie.frame(header).image(:index,5).click $ie.goto(about:blank) $ie.minimize() end Initially i will open an blank browser manually(This is only for first time) and then in Login method i am attaching it and continue my script, in logout method again i am going to direct browser for balnk page. So nxt time when you re-run the script, blank page is available and script runs smoothly. If i directly open browser from the script it will not work. I am not sure what is the exact problem for time being i am using this approach. * On Fri, Dec 12, 2008 at 8:49 PM, Bret Pettichord b...@pettichord.comwrote: Your code is correct. There is something about your configuration that causes this to fail. Bret HAHAHA wrote: I have tried, using this code: require 'watir' browser = Watir::IE.new browser.goto('http://www.google.com') browser2 = Watir::IE.attach(:title, /Google/) browser2.text_field(:name, 'q').set('Watir') browser2.button(:name, 'btnG').click_no_wait The click_no_wait still cannot run. Is the code right? On Dec 12, 9:58 am, larryni...@gmail.com larryni...@gmail.com wrote: Pramod, could you show us an example of your code? On Dec 11, 11:01 pm, pramod D petkar.pra...@gmail.com wrote: Hi Michael, Initially i also faced same problem when i use Click_no_wait control was going but never clicked it, To come around this initially i opened the IE (IE7)with blank page and then, i will attach the browser at the start of the script and continue to execute my script as usual and worked correctly. For time being you can fallow this turn around method. Thanks, Pramod On Fri, Dec 12, 2008 at 1:46 AM, Michael Hwee michael_h...@yahoo.com wrote: That is disappointing. I believe that is something like OS and/or configuration issues, rather than watir itself. Michael - Original Message From: larryni...@gmail.com larryni...@gmail.com To: Watir General watir-general@googlegroups.com Sent: Thursday, December 11, 2008 12:00:00 PM Subject: [wtr-general] Re: button.Click_No_Wait only highlights the button, does not click Sorry, Michael, your code doesn't work either. It opens the page, highlights the button yellow, and then just sits there. No popup is ever launched because it doesn't actually click the button. Watir doesn't report any errors, but it never completes, either. If I change click_no_wait to click!, it does launch the popup, but the handle_nextpopup command never executes - it's been sitting here for 90-120 seconds with the popup open not doing anything. So, again, to summarize: click_no_wait is incapable of firing any events, but click! makes the script hang.- Hide quoted text -
[wtr-general] Browser class
Hi, Can anyone tell me where the code is that uses the Browser class to wrap up the separate implementations of Watir and FireWatir? So we can do this: browser ||= Watir::Browser.new I tried re-opening the Browser class class Watir::Browser def add_some_addtional_methods end end But got a class not found. Cheers Aidy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Browser class
Hi Bret, Thanks for the heads up. We could do a kind_of? or is_a? in a Factory or something. and re-open class Watir:IE; end class FireWatir::Firefox; end Cheers Aidy 2008/12/15 Bret Pettichord b...@pettichord.com: The code is in the commonwatir gem. The reason you got the error is that technically Watir::Browser is a module, not a class. Thus: module Watir::Browser def add_some_addtional_methods end end However, if your intent is to add a method to both Watir::IE and FireWatir::Firefox, this won't do it (yet). Bret aidy lewis wrote: Hi, Can anyone tell me where the code is that uses the Browser class to wrap up the separate implementations of Watir and FireWatir? So we can do this: browser ||= Watir::Browser.new I tried re-opening the Browser class class Watir::Browser def add_some_addtional_methods end end But got a class not found. Cheers Aidy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] object map
Hi, Is anyone still use an object map? def project_action_dropdown browser.select_list(:id, /ProjectListControl_ddlActions/) end project_action_dropdown.select(aaa) I found it highly cumbersome and timeconsuming and felt I didn't really need it when using RegEx. What are other's opinions? Aidy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: It displays error message when I use method bring_to_front.
Hey Tony, Everything's working fine now. The regsvr32 file was located in C:\Windows\system32 folder. I had copied it to the folder where AutoItX3.dll file is located and executed the command. Scripts run fine now. I do NOT get the error anymore. Thank you for the help. Margam On Dec 13, 8:45 pm, Margam nk.mar...@gmail.com wrote: HI Tony, The problem is in the PC at work. I will try out your suggestion on Monday and will reply. Thank you for the suggestion. Margam On Dec 12, 8:08 pm, Tony ynot...@gmail.com wrote: Hi Margam, Weird that regsvr32 is not found hmm... Anyways could try and search for the regsvr32.exe file in location C: \WINDOWS\system32 If present run the command from C:\WINDOWS\system32, else try and get a copy of regsvr32 from another system and copy it to your system. Should work .. but i doubt that regsvr32 is removed from your system. -Tony --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: object map
Is this what you mean by object man? A wrapper accessor method to a DOM control? http://www.bitbucket.org/marekj/watirloo/src/tip/test/select_list_as_face_test.rb marekj | Semantic Page Objects Automation Watirloo: Browser Page Helper Framework http://www.bitbucket.org/marekj/watirloo/ for IE, Firefox and others? On Mon, Dec 15, 2008 at 12:07 PM, aidy lewis aidy.le...@googlemail.comwrote: Hi, Is anyone still use an object map? def project_action_dropdown browser.select_list(:id, /ProjectListControl_ddlActions/) end project_action_dropdown.select(aaa) I found it highly cumbersome and timeconsuming and felt I didn't really need it when using RegEx. What are other's opinions? Aidy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: object map
Hi Marekj, Not exactly sure what you are doing here, but maybe you could look at delegation or the factory pattern to factor out the conditional statement. Aidy On 15/12/2008, marekj marekj@gmail.com wrote: Is this what you mean by object man? A wrapper accessor method to a DOM control? http://www.bitbucket.org/marekj/watirloo/src/tip/test/select_list_as_face_test.rb marekj | Semantic Page Objects Automation Watirloo: Browser Page Helper Framework http://www.bitbucket.org/marekj/watirloo/ for IE, Firefox and others? On Mon, Dec 15, 2008 at 12:07 PM, aidy lewis aidy.le...@googlemail.com wrote: Hi, Is anyone still use an object map? def project_action_dropdown browser.select_list(:id, /ProjectListControl_ddlActions/) end project_action_dropdown.select(aaa) I found it highly cumbersome and timeconsuming and felt I didn't really need it when using RegEx. What are other's opinions? Aidy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] How to handle file download popups in Firefox?
Hello Everyone, I have been trying to handle File Download pops in FF browser. I had posted a similar question in the FireWatir group (http:// groups.google.com/group/firewatir/browse_thread/thread/ 645846692f7d64fd?ie=utf-8oe=utf-8q=watir+-+file+download+in +Firefox#903516a40a227883), But I thought it would be better here, as I am actually using Watir. My script works successfully until the popup is shown, but does nothing after that. The code is very similar to the one that I use for IE. -- require 'watir' require 'win32ole' Watir::Browser.default='firefox' $browser=Watir::Browser.new def save_file(filename) filepath = c:\\#{File.basename(filename, '.rb')} sleep(10) ai = WIN32OLE.new(AutoItX3.Control) window_title = ai.WinGetTitle([active]) # This is to get the title of the popup. Since this changes in FF, for every file download. sleep 1 ai.ControlFocus(window_title, , OK) sleep 1 ai.ControlClick(window_title, , OK) sleep 1 ai.ControlSend(Enter name of file to save to..., , Edit,filepath) sleep 1 ai.ControlClick(Enter name of file to save to..., , Save) window_title1 = Enter name of file to save to... ai.ControlFocus(window_title1, , Yes) sleep 1 ai.ControlClick(window_title1, , Yes) end $browser.goto(http://abcd.com;) sleep 2 $browser.link(:text, zzz.zip).click sleep 5 save_file(zzz) -- The popup remains and nothing happens. The scripts finishes running without any errors. But the same code works great with IE. Can someone help in pointing the problem here? Also how to control Radio buttons using AutoIt (for the same file download popup). Thank you very much. Margam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Turning Javascript on and off
Just to update here is a version of my final routine Hope it helps someone else Paul -- def JavaScript(zone,on=nil,silent=nil) # if on is nil it returns true iff javascript is enabled (not it could also be off or prompt, both false) # if true it sets it to enabled # if false it sets it to disabled # It does not set it to prompt (but could - not sure why you would) # silent - set it to anything and it does not output what it is doing case (zone) when 1: zonename = Local intranet zone when 2: zonename = Trusted sites zone when 3: zonename = Internet zone when 4: zonename = Restricted sites zone else fail Arguement error when calling function JavaScript - zone # {zone} must be 1,2,3, or 4 end if (!silent) puts Call JavaScript(#{on.inspect}) end keyname = 'Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\\'+zone.to_s key_r = Win32::Registry::HKEY_CURRENT_USER.open(keyname) if (!key_r) fail Registry HKEY_CURRENT_USER #{keyname} not found end valuename = '1400' type,data = key_r.read(valuename) if (!data) fail Registry HKEY_CURRENT_USER #{keyname} - value #{valuename} not found end javascript_was_on = (data==0) if (on==nil) if (javascript_was_on) if (!silent) puts IE Javascript is on in #{zonename} end else if (!silent) puts IE Javascript is off in #{zonename} end end return javascript_was_on end if (on) if (!javascript_was_on) key_w = Win32::Registry::HKEY_CURRENT_USER.open (keyname,Win32::Registry::KEY_WRITE) key_w.write(valuename,Win32::Registry::REG_DWORD,0) if (!silent) puts Turning IE Javascript on in #{zonename} end else if (!silent) puts IE Javascript was on in #{zonename} end end else if (javascript_was_on) key_w = Win32::Registry::HKEY_CURRENT_USER.open (keyname,Win32::Registry::KEY_WRITE) key_w.write(valuename,Win32::Registry::REG_DWORD,3) if (!silent) puts Turning IE Javascript off in #{zonename} end else if (!silent) puts IE Javascript was off in #{zonename} end end end return javascript_was_on end --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---