[wtr-general] Re: Script hangs while trying to close pop up
Thanks a lot Tiffany for your reply, I tried other things too too like dialog.button('Cancel').click , click_no_wait and I tried Auto it etc but of no use. I am working on in further, will get back to you if I find something useful. By the way do you think that the script that I have posted above is incorrect or I need to modify it. Thanks Namit On Aug 25, 8:30 pm, tcfodor tcfo...@comcast.net wrote: Hi Namit, You may have already looked here, but the bulk of the knowledge on Watir and popups can be found here: http://wiki.openqa.org/display/WTR/Pop+Ups Off the top of my head, it seems like there were cases where we needed to use click_no_wait instead of just click to avoid hanging. Hope this helps! -Tiffany On Aug 25, 7:05 am, Namit namitjai...@gmail.com wrote: Hi All, My scenario is to click a image that results in a pop up. I want to click OK button of this Pop up. This is a straight scenario without much complexity still the script is not working and the pop up remains as it is. Here is my sample script require 'watir' require 'win32ole' require 'watir/ie' require 'watir\contrib\enabled_popup' $ie = Watir::IE.new $ie.goto 'some url/' $ie.button(:src, 'http://img1.yatra.com/yatra_blue-theme/images/common/ spacer.gif').click sleep 10 if $ie.enabled_popup puts 'inside if loop' hwnd =$ie.enabled_popup(10) puts hwnd w = WinClicker.new w.makeWindowActive(hwnd) w.clickWindowsButton_hwnd(hwnd,OK) end This script after clicking the image hangs and after this there is no action performed. The pop is a simple pop up with an OK button. Guys please tell me where I am going wrong. Any help will be highly appreciated Thanks Namit --~--~-~--~~~---~--~~ 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: Script hangs while trying to close pop up
I have found that one important thing that people miss out on is that Ruby 1.8.6.27 doesn’t support click_no_wait. So I hope you are not using this version of Ruby. If yes then try with Ruby 1.8.6.26 Also always use sleep after click_no_wait and the pop-up handler method Thanks, Rohan Ojha -Original Message- From: watir-general@googlegroups.com [mailto:watir-gene...@googlegroups.com] On Behalf Of Namit Sent: Wednesday, August 26, 2009 11:35 AM To: Watir General Subject: [wtr-general] Re: Script hangs while trying to close pop up Thanks a lot Tiffany for your reply, I tried other things too too like dialog.button('Cancel').click , click_no_wait and I tried Auto it etc but of no use. I am working on in further, will get back to you if I find something useful. By the way do you think that the script that I have posted above is incorrect or I need to modify it. Thanks Namit On Aug 25, 8:30 pm, tcfodor tcfo...@comcast.net wrote: Hi Namit, You may have already looked here, but the bulk of the knowledge on Watir and popups can be found here: http://wiki.openqa.org/display/WTR/Pop+Ups Off the top of my head, it seems like there were cases where we needed to use click_no_wait instead of just click to avoid hanging. Hope this helps! -Tiffany On Aug 25, 7:05 am, Namit namitjai...@gmail.com wrote: Hi All, My scenario is to click a image that results in a pop up. I want to click OK button of this Pop up. This is a straight scenario without much complexity still the script is not working and the pop up remains as it is. Here is my sample script require 'watir' require 'win32ole' require 'watir/ie' require 'watir\contrib\enabled_popup' $ie = Watir::IE.new $ie.goto 'some url/' $ie.button(:src, 'http://img1.yatra.com/yatra_blue-theme/images/common/ spacer.gif').click sleep 10 if $ie.enabled_popup puts 'inside if loop' hwnd =$ie.enabled_popup(10) puts hwnd w = WinClicker.new w.makeWindowActive(hwnd) w.clickWindowsButton_hwnd(hwnd,OK) end This script after clicking the image hangs and after this there is no action performed. The pop is a simple pop up with an OK button. Guys please tell me where I am going wrong. Any help will be highly appreciated Thanks Namit --~--~-~--~~~---~--~~ 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] Is there a method to handling modal dialog but not providing the title?
Hi, guys, I mean that sometimes, we know there is a modal dialog but we won't to know the title. For following, we must provide a title. But I don't want to provide it sometimes. = autoit=WIN32OLE.new('AutoItX3.Control') #ret=autoit.WinWait(title,,180) # wait the popups for 3 minutes. ret=autoit.WinWait(title,,60) # wait the popups for 3 minutes. ... = Any suggestion would be quite appreciated. Thanks. Wesley Chen. --~--~-~--~~~---~--~~ 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: Watir fire_event that opens a modal dialog no wait needed
Hi Adrian, The above code works fine for me ... by changing img.fire_event_no_wait(mousedown) to img.fire_event_no_wait (onmousedown) Maybe you could post the whole code that you are using ... so we could take a look at what you are exactly trying to do...?? Not sure on the threads -- I believe if there is a blocking part within a thread .. it should not block on the other threads. Thanks, 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: Is there a method to handling modal dialog but not providing the title?
Hi, If you do not want to use title of the pop up then you can use the hwnd command to close the pop up by just passing the caption of button. Visit this URl for some sample examples. http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups Thanks Namit On Aug 26, 11:42 am, Wesley Chen cjq@gmail.com wrote: Hi, guys, I mean that sometimes, we know there is a modal dialog but we won't to know the title. For following, we must provide a title. But I don't want to provide it sometimes. = autoit=WIN32OLE.new('AutoItX3.Control') # ret=autoit.WinWait(title,,180) # wait the popups for 3 minutes. ret=autoit.WinWait(title,,60) # wait the popups for 3 minutes. ... = Any suggestion would be quite appreciated. Thanks. Wesley Chen. --~--~-~--~~~---~--~~ 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: Is there a method to handling modal dialog but not providing the title?
Hi, Namit, Your suggestion maybe good. I know some kinds of solution. But if I use autoit, there is no title, how can I make it? autoit=WIN32OLE.new('AutoItX3.Control') ret=autoit.WinWait(*title*,,60) Thanks. Wesley Chen. On Wed, Aug 26, 2009 at 3:08 PM, Namit namitjai...@gmail.com wrote: Hi, If you do not want to use title of the pop up then you can use the hwnd command to close the pop up by just passing the caption of button. Visit this URl for some sample examples. http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups Thanks Namit On Aug 26, 11:42 am, Wesley Chen cjq@gmail.com wrote: Hi, guys, I mean that sometimes, we know there is a modal dialog but we won't to know the title. For following, we must provide a title. But I don't want to provide it sometimes. = autoit=WIN32OLE.new('AutoItX3.Control') #ret=autoit.WinWait(title,,180) # wait the popups for 3 minutes. ret=autoit.WinWait(title,,60) # wait the popups for 3 minutes. ... = Any suggestion would be quite appreciated. Thanks. Wesley Chen. --~--~-~--~~~---~--~~ 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: Is there a method to handling modal dialog but not providing the title?
Hi Wesley, There is a different technique to handling popups without autoit - This will act only on the current ie window which watir is using not any other browser. The below will handle alert, confirm , prompt, auth dialog box. Usage: require 'watir' iewin = Watir::IE.new iewin.goto(http://www.w3schools.com/js/tryit_view.asp? filename=tryjs_alert) iewin.button(:value, Show alert box).click_no_wait txt = iewin.clickprompt() puts txt #prints the popup text You would have to add the below code to C:\ruby\lib\ruby\gems\1.8\gems \watir-1.6.2\lib\watir\ie-class.rb ( add into module Watir, class IE http://pastie.org/595060 Thanks, 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] Safariwatir attach?
Hi all Does anyone know if there's a safariwatir equivalent of the attach method for IE? If not, is there a workaround? I need to be able to switch focus to pop-up html windows and continue testing within these, and if I can't, safariwatir is pretty much useless for what I need to do! Thanks kindly --~--~-~--~~~---~--~~ 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: Is there a method to handling modal dialog but not providing the title?
Hi, Tony, Thank you very much for the quick reply. :), 1) I can't find the *below code*; 2)will iewin.clickprompt( ) click the button on the pop up? If it does, if on the pop up, there are two buttons such as OK/Cancel, how to identify them? Thanks. Wesley Chen. On Wed, Aug 26, 2009 at 3:43 PM, Tony ynot...@gmail.com wrote: Hi Wesley, There is a different technique to handling popups without autoit - This will act only on the current ie window which watir is using not any other browser. The below will handle alert, confirm , prompt, auth dialog box. Usage: require 'watir' iewin = Watir::IE.new iewin.goto(http://www.w3schools.com/js/tryit_view.asp? filename=tryjs_alerthttp://www.w3schools.com/js/tryit_view.asp?%0Afilename=tryjs_alert ) iewin.button(:value, Show alert box).click_no_wait txt = iewin.clickprompt() puts txt #prints the popup text You would have to add the below code to C:\ruby\lib\ruby\gems\1.8\gems \watir-1.6.2\lib\watir\ie-class.rb ( add into module Watir, class IE http://pastie.org/595060 Thanks, 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: Is there a method to handling modal dialog but not providing the title?
Hi Wesley, iewin.clickprompt() will click the button in the popup and return the popup text. This is the definition - def clickprompt(but=OK,txt =, waitTime = 10) iewin.clickprompt(CANCEL) # will click cancel button.. actually if you pass in anything other than OK, cancel will be clicked. iewin.clickprompt(OK) or iewin.clickprompt() will click the ok button. iewin.clickprompt(OK, input text) #can be used to pass in values into the prompt box. iewin.clickprompt(OK, , 20) #can increase the wait time for the popup to occur. time = 20*0.2 will return '' if there is no popup. Code is present here - http://pastie.org/595060 Pasting it here also - def clickprompt(but=OK,txt =, waitTime = 10) tim = 0 poptxt= '' while tim waitTime sleep 0.2 pophwnd = Win32API.new(user32, GetWindow, 'Li', 'L').Call (@ie.hwnd.to_i, 6) # the above returns any popup windows that are present for the specific window tim += 0.2 tim += waitTime if pophwnd != 0 end return '' if pophwnd == 0 button = but.upcase outval = ' ' * 30 Win32API.new(user32, GetWindowText, 'Lpi', 'L').Call (pophwnd,outval,30) popwndtitle = outval.rstrip.chomp(\000) # window title stored here outval = nil #poptype = 0 #alert and confirm have ie6 - Microsoft Internet Explorer #ie7 - Windows Internet Explorer #ie8 - Message from webpage if popwndtitle.include?(Microsoft Internet Explorer) || popwndtitle.include?(Windows Internet Explorer) || popwndtitle.include?(Message from webpage) #confirm and alerts have the above 3 window titles # poptype =1 means this is a javascript alert tag #poptype = 1 poptxt = handlepopup1(pophwnd,button) elsif popwndtitle.include?(Explorer User Prompt) #prompts have the above window title #poptype = 2 poptxt = handlepopup2(pophwnd,button, txt) elsif popwndtitle.include?(Connect to) #authentication dialog #also make sure the username and password text fields are present - if present we got the auth dialog cntrlhwnd = 0 cntrlhwnd = Win32API.new(user32, GetDlgItem, 'Li', 'L').Call(pophwnd, 1002) #poptype = 3 if cntrlhwnd != 0 #verified the 2 textboxes are present to enter the values return '' if cntrlhwnd == 0 poptxt = handlepopup3(pophwnd,button, prompt) end return poptxt end def handlepopup1(pophwnd, button) # handles the alerts and confirm dialogs #Yes there is a popupwindow... hence get the controlhandle for the text control - 65535 cntrlhwnd = Win32API.new(user32, GetDlgItem, 'Li', 'L').Call (pophwnd, 65535) #now get the text from the popup outval = ' ' * 900 Win32API.new(user32, GetWindowText, 'Lpi', 'L').Call (cntrlhwnd,outval, 900) poptext = outval.rstrip.chomp(\000) outval = nil #confirm ok-1 and cancel-2, alert ok-2 cntrlhwndOK = 0 cntrlhwndCANCEL = 0 cntrlhwndOK = Win32API.new(user32, GetDlgItem, 'Li', 'L').Call (pophwnd, 1) if cntrlhwndOK == 0 # only 1 button alert cntrlhwndOK = Win32API.new(user32, GetDlgItem, 'Li', 'L').Call(pophwnd, 2) clickWin32Button(cntrlhwndOK) # done clicking javascript ok button return poptext else # this is a confirm with 2 buttons cntrlhwndCANCEL = Win32API.new(user32, GetDlgItem, 'Li', 'L').Call(pophwnd, 2) end button.include?(OK) ? clickWin32Button(cntrlhwndOK) : clickWin32Button(cntrlhwndCANCEL) #clickWin32Button(cntrlhwndCANCEL) return poptext end private :handlepopup1 def handlepopup2(pophwnd, button, prompt) #handles prompt boxes which takes a value as input cntrlhwndOK = Win32API.new(user32, GetDlgItem, 'Li', 'L').Call (pophwnd, 1) cntrlhwndCANCEL = Win32API.new(user32, GetDlgItem, 'Li', 'L').Call(pophwnd, 2) # get handle to the text control from the prompt box cntrlpromptText = Win32API.new(user32, GetDlgItem, 'Li', 'L').Call(pophwnd, 8132) #now get the text from the popup outval = ' ' * 200 Win32API.new(user32, GetWindowText, 'Lpi', 'L').Call (cntrlpromptText,outval, 200) poptext = outval.rstrip.chomp(\000) outval = nil cntrltextarea = Win32API.new(user32, GetDlgItem, 'Li', 'L').Call(pophwnd, 8133) if prompt.size != 0 sendmessage = Win32API.new(user32, SendMessage, 'LLpp', 'L') sendmessage.Call(cntrltextarea, 0x000C, '', prompt) # calling sendmessage with WM_SETTEXT end button.include?(OK) ? clickWin32Button(cntrlhwndOK) : clickWin32Button(cntrlhwndCANCEL) return poptext end private :handlepopup2 def handlepopup3(pophwnd, button, prompt) # handles the auth dialog box , 3 tries then the 401 page is shown cntrlhwnd = Win32API.new(user32, GetDlgItem, 'Li', 'L').Call (pophwnd, 1002) cntrlusername = Win32API.new(user32, GetDlgItem, 'Li', 'L').Call(cntrlhwnd,
[wtr-general] Re: Watir fire_event that opens a modal dialog no wait needed
Hi Tony, Thanks for trying to help me out. Here is the ruby script. The app is a servlet. Onmouseover works just fine, also fire_event(onmousedown) works, but this opens a modal dialog and the program is stuck on the fire_event line. require 'rubygems' require 'watir' class RunProg def Run() puts(Inside Run) ie = Watir::IE.new ie.goto app_link e = Watir::IE.attach(:title, /APP Title/) e.button(:id, menu_button_id).click d = e.div(:id, sub_menu_div_id) t = d.table(:index, 1) r = t.row(:index, 1) puts(r) r.fire_event(onmouseover) r.fire_event_no_wait(onmousedown) puts e.url end end RunProg.new.Run() On Wed, Aug 26, 2009 at 9:53 AM, Tony ynot...@gmail.com wrote: Hi Adrian, The above code works fine for me ... by changing img.fire_event_no_wait(mousedown) to img.fire_event_no_wait (onmousedown) Maybe you could post the whole code that you are using ... so we could take a look at what you are exactly trying to do...?? Not sure on the threads -- I believe if there is a blocking part within a thread .. it should not block on the other threads. Thanks, 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] A real newbie question
Hi all, Sorry to annoy you with such a basic question, no doubt, but I am really struggling on the basics... I am using firefox instead of ie and am not too sure on some of my ruby code. I have hacked it here and there and now I am not too sure what I am doing wrong. I am using SciTE editor and have the following in the window: require 'firewatir' Test_site=http://www.google.com Ff=Firefox.new goto test_site text_field(:name, 'q').set 'Watir' button(:name, 'btnG').click if ff.contains_text('Web Application') puts 'Test Passed' else puts 'Test Failed' end The output I see is: ruby test26aug.rb test26aug.rb:2: undefined local variable or method `www' for main:Object (NameError) Exit code: 1 I use igoogle and whenever I select google, it will default there. Could that be the issue? Thanks in advance, and sorry for the dumb question... Matt --~--~-~--~~~---~--~~ 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: A real newbie question
On Wed, Aug 26, 2009 at 1:37 PM, Matt matt.walt...@three.com.au wrote: Test_site=http://www.google.com test26aug.rb:2: undefined local variable or method `www' for main:Object (NameError) You have forgot quotes: Test_site=http://www.google.com; Željko -- http://watirpodcast.com/ --~--~-~--~~~---~--~~ 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] Not able to enter login credentials in Sign In section
Hi, This is a test site https://sandbox.google.com/checkout/view/buy? o=shoppingcartshoppingcart=322449560105091pli=1tzfp=wg-14ArD In this I am not able to enter login credentails in the Sign In section. -- require 'watir' require 'test/unit' require 'win32ole' $ie = Watir::IE.new test_site='https://sandbox.google.com/checkout/view/buy? o=shoppingcartshoppingcart=322449560105091pli=1tzfp=wg-14ArD' $ie.goto(test_site) $ie.show_frames $ie.text_field(:name, Email).set(a) #$ie.text_field(:name, Passwd).set('b') -- $ie.show_frames - it shows -- there are 2 frames frame index: 1 name: signup frame index: 2 Access Denied, see http://wiki.openqa.org/display/WTR/FAQ#access-denied d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:52:in `assert_exists': Unable to locate element, using :name, Email (Watir::Exc eption::UnknownObjectException) from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ element.rb:284:in `enabled?' from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ element.rb:56:in `assert_enabled' from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ input_elements.rb:323:in `set' from D:/ruby/samples/RubySrc-1.8.6-p111/sample/ DriverCentral_Scripts/test/t.rb:11 --- Please help how can I enter login credentials in Sign In section. Thanks Maumita --~--~-~--~~~---~--~~ 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: A real newbie question
Cheers - thanks for that. On Aug 26, 9:53 pm, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Wed, Aug26,2009at1:37PM, Matt matt.walt...@three.com.au wrote: Test_site=http://www.google.com test26aug.rb:2: undefined local variable or method `www' for main:Object (NameError) You have forgot quotes: Test_site=http://www.google.com; Željko --http://watirpodcast.com/ --~--~-~--~~~---~--~~ 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: A real newbie question
Cheers - thanks for that. On Aug 26, 9:53 pm, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Wed, Aug26,2009at1:37PM, Matt matt.walt...@three.com.au wrote: Test_site=http://www.google.com test26aug.rb:2: undefined local variable or method `www' for main:Object (NameError) You have forgot quotes: Test_site=http://www.google.com; Željko --http://watirpodcast.com/ --~--~-~--~~~---~--~~ 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: A real newbie question
The first error is the missing double quotes, like Željko pointed out. Your script will still not run though as there are a couple of other errors. You set up the browser like this: $ff = FireWatir::Firefox.new instead of: Ff=Firefox.new (if you use a capital letter, you set up the browser instance a constant, most people use a global variable instead.) You also tend to set up things as constants (e.g. Test_site on line 2) and then call it as a local variable (test_site on line 4) - remember, the variables are case sensitive... You also need to call the various methods like button, text_field, etc on the browser object, $ff in this case. So the script would become something like this: require 'firewatir' test_site = http://www.google.com; $ff = FireWatir::Firefox.new $ff.goto test_site $ff.text_field(:name, 'q').set 'Watir' $ff.button(:name, 'btnG').click if $ff.contains_text('Web Application') puts 'Test Passed' else puts 'Test Failed' end I hope this helps. Regards, John --~--~-~--~~~---~--~~ 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: Not able to enter login credentials in Sign In section
Well, your code isn't finding the sign in text fields in the first place. Are you sure that the name value for those fields are Email and Passwd? Keep in mind the name field is specifically declared, it isn't just whatever text is nearby. Also, it looks like the first frame is called signup, so the text_field elements might be in there. You could try: $ie.frame(:index,1).text_field(:name,Email).set(a) frames hide their html from the parent frame/window, so if the login fields are in a frame, looking for the fields in the main window wont work. -Dylan On Aug 26, 4:55 am, Maumita maumita.majum...@gmail.com wrote: Hi, This is a test site https://sandbox.google.com/checkout/view/buy? o=shoppingcartshoppingcart=322449560105091pli=1tzfp=wg-14ArD In this I am not able to enter login credentails in the Sign In section. -- require 'watir' require 'test/unit' require 'win32ole' $ie = Watir::IE.new test_site='https://sandbox.google.com/checkout/view/buy? o=shoppingcartshoppingcart=322449560105091pli=1tzfp=wg-14ArD' $ie.goto(test_site) $ie.show_frames $ie.text_field(:name, Email).set(a) #$ie.text_field(:name, Passwd).set('b') -- $ie.show_frames - it shows -- there are 2 frames frame index: 1 name: signup frame index: 2 Access Denied, seehttp://wiki.openqa.org/display/WTR/FAQ#access-denied d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:52:in `assert_exists': Unable to locate element, using :name, Email (Watir::Exc eption::UnknownObjectException) from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ element.rb:284:in `enabled?' from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ element.rb:56:in `assert_enabled' from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ input_elements.rb:323:in `set' from D:/ruby/samples/RubySrc-1.8.6-p111/sample/ DriverCentral_Scripts/test/t.rb:11 --- Please help how can I enter login credentials in Sign In section. Thanks Maumita --~--~-~--~~~---~--~~ 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: Help selecting elements of a drop down list when the site uses Javascript/ASP.net
Thanks for your response, Chuck. I tried clearing the selection first, and that didn't seem to make a difference. The changing of the dropdown box does in fact trigger a postback: onchange=javascript:setTimeout('__doPostBack (\'FacsimileSearchControl1$FromDateDropdownlist\',\'\')', 0) I am afraid I'm a bit out of my element in understanding this part. I tried adding the sleep commands in as well, and that didn't help either. The thing that confuses me is that, when you manually open the site (which, btw, is a public site for looking at detailed reports about banks), the dropdown list is populated with dates, such as 06/31/2009. Yet, when I load up the options of the dropdown into an array and put that out, the array contains these values: 91 111 98 106 101 99 116 32 72 84 77 76 79 I assume these values somehow drive the javascript which populates the dropdown. But I have not figured out a way to simply get at the nth element in the dropdown. Do you have any ideas? I really appreciate the help! On Aug 24, 11:41 am, Chuck van der Linden sqa...@gmail.com wrote: Try clearing the current selection, before selecting another value in the selection list. Also since picking the radio button causes the page to re-render (or is it a postback?), you might need to put in a small wait for a second or two after doing that to give the browser a chance to do it's thing before you start populating the search field and ripping through the from-dates The same goes for after firing the onchange, that initiates some kind of re-render or postback (I'd have to be running fiddler to see if it's actually hitting the server) and you might need a allow a little time for that to take place. Have you tried using an IRB session to walk through this manually so you can see what steps are working and what steps are not working? (you'd probably want to omit the loops, but otoh you could use something like puts dropdate.options to see if it's able to get the list of options for the select list you never really indicated what happens when you run the code above (and given the site involved, I'm NOT going to try it for myself ;-) are you getting some kind or error at any point, or is the site just not reacting to the onchange, or what? On Aug 21, 2:40 pm, Doodle jeffrey.eman...@gmail.com wrote: Hi everyone, I'm loving Watir so far but running into a wall with a certain site. The site uses javascript/asp.net to control a drop down list. I have gone crazy trying different things to use select_list, but nothing seems to work. I just want to be able to select the nth element in a dropdown list, but if I look for certain text it won't work, and if I grab the contents and try to set it that way it also doesn't work. I suspect it has to do with using javascript and the fire_event function, but this does not seem to be very well documented. Also, I am a novice ruby code so any tips or feedback in terms of the general coding style would be greatly appreciated. Thanks! Here is a copy of the code I'm using, presented below the line. 'C:\BankData\failedbankcertcodes.txt' is a txt file containing just these lines: 26870 26535 28344 27011 33901 34194 34881 23556 22574 18659 34043 32069 34341 27367 23124 35469 _ require 'firewatir' require 'rubygems' require 'ftools' include FireWatir ff=Firefox.new certlist='C:\BankData\failedbankcertcodes.txt' File.readlines(certlist).each do |line| urlstring =https://cdr.ffiec.gov/public/ManageFacsimiles.aspx; ff.goto(urlstring) ff.radio(:name, FacsimileSearchControl1:identifierRButton).set ff.select_list(:name,FacsimileSearchControl1:uniqueIDDropdown).select (FDIC Certificate Number) ff.text_field(:name, FacsimileSearchControl1:uniqueIDTextBox).set line datedrop=ff.select_list (:name,FacsimileSearchControl1:FromDateDropdownlist) reportdates=datedrop.options() for i in 0..reportdates.size datedrop.set reportdates[i] datedrop.fire_event(onchange) ff.button(:name, tabStrip:_ctl2).click begin ff.button(:name, SearchResultsControl1:CallReportDataGrid:_ctl0:_ctl4:MyButton).click ff.radio(:name, FacsimileDownloadControl1:formatButtonList).set SDF ff.button (:name,FacsimileDownloadControl1:downloadTabStrip:_ctl2).click rescue puts reportdates[i] end end 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 -~--~~~~--~~--~--~---
[wtr-general] Query : How to Count the Value or No of Items in Select List box
Hi Everybody... I am new to Ruby, Watir and this Group i am automating a web based application *1. My web page has Drop down list box or Select list box* *2. It has 10 items ( Eg: 10 Diff car names Audi, BMW, Mazda etc) or it can contain N of Cars also* Scenario 1. After selecting the car, the page gets refreshed and i have to write the details of the car in the Excel sheet ...like this it happens for every car before this i have know No of Car available in the List; 2. After having the Car Count can loop for N no of Cars is there anyway to Count no of items in the Select List using the VALUE 1st CAR : Value = 0 2nd CAR : Value = 1 3rd CAR : Value = 2 4th CAR : Value = 3 Please help me out Regards Rafiq --~--~-~--~~~---~--~~ 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: Script hangs while trying to close pop up
Hello Namit, Please see the google example in my response to the following post - will watir-1.6.2 support pop-up message http://groups.google.com/group/watir-general/browse_thread/thread/eeb37d3a8562936/e9ec1258c2aa547f?hl=enq=#e9ec1258c2aa547f You must use click_no_wait Good luck, Darryl On Aug 26, 3:05 am, Namit namitjai...@gmail.com wrote: Hi Rohan Thanks for your reply I am using 1.8.6.26 version and also I used sleep after this command but in vain. I am working on it further, will reply with my observations Thanks Namit On Aug 26, 11:37 am, Rohan Ojha rohan.o...@bsil.com wrote: I have found that one important thing that people miss out on is that Ruby 1.8.6.27 doesn’t support click_no_wait. So I hope you are not using this version of Ruby. If yes then try with Ruby 1.8.6.26 Also always use sleep after click_no_wait and the pop-up handler method Thanks, Rohan Ojha -Original Message- From: watir-general@googlegroups.com [mailto:watir-gene...@googlegroups.com] On Behalf Of Namit Sent: Wednesday, August 26, 2009 11:35 AM To: Watir General Subject: [wtr-general] Re: Script hangs while trying to close pop up Thanks a lot Tiffany for your reply, I tried other things too too like dialog.button('Cancel').click , click_no_wait and I tried Auto it etc but of no use. I am working on in further, will get back to you if I find something useful. By the way do you think that the script that I have posted above is incorrect or I need to modify it. Thanks Namit On Aug 25, 8:30 pm, tcfodor tcfo...@comcast.net wrote: Hi Namit, You may have already looked here, but the bulk of the knowledge on Watir and popups can be found here: http://wiki.openqa.org/display/WTR/Pop+Ups Off the top of my head, it seems like there were cases where we needed to use click_no_wait instead of just click to avoid hanging. Hope this helps! -Tiffany On Aug 25, 7:05 am, Namit namitjai...@gmail.com wrote: Hi All, My scenario is to click a image that results in a pop up. I want to click OK button of this Pop up. This is a straight scenario without much complexity still the script is not working and the pop up remains as it is. Here is my sample script require 'watir' require 'win32ole' require 'watir/ie' require 'watir\contrib\enabled_popup' $ie = Watir::IE.new $ie.goto 'some url/' $ie.button(:src, 'http://img1.yatra.com/yatra_blue-theme/images/common/ spacer.gif').click sleep 10 if $ie.enabled_popup puts 'inside if loop' hwnd =$ie.enabled_popup(10) puts hwnd w = WinClicker.new w.makeWindowActive(hwnd) w.clickWindowsButton_hwnd(hwnd,OK) end This script after clicking the image hangs and after this there is no action performed. The pop is a simple pop up with an OK button. Guys please tell me where I am going wrong. Any help will be highly appreciated Thanks Namit --~--~-~--~~~---~--~~ 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] Query : How to Count the Value or No of Items in Select List box
Hi Everybody... I am new to Ruby, Watir and this Group i am automating a web based application 1. My web page has Drop down list box or Select list box 2. It has 10 items ( Eg: 10 Diff car names Audi, BMW, Mazda etc) or it can contain N of Cars also Scenario 1. After selecting the car, the page gets refreshed and i have to write the details of the car in the Excel sheet ...like this it happens for every car before this i have know No of Car available in the List; 2. After having the Car Count can loop for N no of Cars is there anyway to Count no of items in the Select List using the VALUE 1st CAR : Value = 0 2nd CAR : Value = 1 3rd CAR : Value = 2 4th CAR : Value = 3 Please help me out Regards Rafiq --~--~-~--~~~---~--~~ 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: A real newbie question
Thanks for your help John - I really appreciate it. As you rightly pointed out, it still didn't work, but I didn't want to annoy you all again with another post. I will try this tonight when I get home. Cheers, Matt On Aug 26, 11:38 pm, John Kolokotronis johnj...@gmail.com wrote: The first error is the missing double quotes, like Željko pointed out. Your script will still not run though as there are a couple of other errors. You set up the browser like this: $ff = FireWatir::Firefox.new instead of: Ff=Firefox.new (if you use a capital letter, you set up the browser instance a constant, most people use a global variable instead.) You also tend to set up things as constants (e.g. Test_site on line 2) and then call it as a local variable (test_site on line 4) - remember, the variables are case sensitive... You also need to call the various methods like button, text_field, etc on the browser object, $ff in this case. So the script would become something like this: require 'firewatir' test_site = http://www.google.com; $ff = FireWatir::Firefox.new $ff.goto test_site $ff.text_field(:name, 'q').set 'Watir' $ff.button(:name, 'btnG').click if $ff.contains_text('Web Application') puts 'Test Passed' else puts 'Test Failed' end I hope this helps. Regards, John --~--~-~--~~~---~--~~ 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 double click on Element
I am a new watir user, now I am writing a function,double click a element in the table,it will jump detail page how I can to deal with double click on Element in watir? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---