[wtr-general] javascript
Hi All, I have query regarding with javascript popup. I want to verify OK and CANCEL in the popup box. Please help me in this regard. Thanks, kiran. --~--~-~--~~~---~--~~ 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 so much, I tried your code, it works perfect! It is amazing! Thanks. Wesley Chen. On Wed, Aug 26, 2009 at 4:49 PM, Tony ynot...@gmail.com wrote: 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
[wtr-general] Re: Watir fire_event that opens a modal dialog no wait needed
Hi Adrian, You are trying to fire_event on the row. Could you provide the html or part of the html that contains the row? The row should have the mousedown event. The fireevent will only return after the modal dialog is clicked on. fire_event_no_wait will return after the call. Could you change your code to below and try again - I have removed the r.fire_event(onmouseover) which blocks if a modal dialog is shown here ... and used only r.fire_event_no_wait (onmousedown) 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_no_wait(onmousedown) # it should not block here puts e.url end end 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: javascript
Hi Kumar, You can use the following code with the changes according to ur pop-up window: ai = WIN32OLE.new(AutoItX3.Control) ai.WinWait(File Download, , 5) //Here the first argument is the Title of pop-up window and thrid is the waiting time ai.ControlFocus(File Download, , Open) //First argument is same as described above,Third option for you can be OK or Cancel ai.ControlClick(File Download, , Open) //First argument is same as described above,Third option for you can be OK or Cancel For further help please revert back. Thanks Regards, Ankur Gera --~--~-~--~~~---~--~~ 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
On Thu, Aug 27, 2009 at 2:35 AM, Doodle jeffrey.eman...@gmail.com wrote: site (which, btw, is a public site for looking at detailed reports about banks), Can you send us a link and let us know what you want to do? Ž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: javascript
Hi Ankur, Thank you very much for your reply. I dont want click on any button on popup. I want to verify the desired buttons are exist or not. Thanks, kiran. On Aug 27, 11:55 am, Ankur Gera ankurg...@gmail.com wrote: Hi Kumar, You can use the following code with the changes according to ur pop-up window: ai = WIN32OLE.new(AutoItX3.Control) ai.WinWait(File Download, , 5) //Here the first argument is the Title of pop-up window and thrid is the waiting time ai.ControlFocus(File Download, , Open) //First argument is same as described above,Third option for you can be OK or Cancel ai.ControlClick(File Download, , Open) //First argument is same as described above,Third option for you can be OK or Cancel For further help please revert back. Thanks Regards, Ankur Gera --~--~-~--~~~---~--~~ 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: javascript
Hi Kumar, Then you can use the function GUICtrlGetState for getting info of the state of the required button. But you have to use autoit for accessing the pop-up and its controls as i have described in my previous mail of how to use it. For further help please revert back. Thanks Regards, Ankur Gera --~--~-~--~~~---~--~~ 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: javascript
Hmmm...i got a solutionn to do it by using ControlGetText method Thanks, kiran. On Aug 27, 12:43 pm, kumar gki...@gmail.com wrote: Hi Ankur, Thank you very much for your reply. I dont want click on any button on popup. I want to verify the desired buttons are exist or not. Thanks, kiran. On Aug 27, 11:55 am, Ankur Gera ankurg...@gmail.com wrote: Hi Kumar, You can use the following code with the changes according to ur pop-up window: ai = WIN32OLE.new(AutoItX3.Control) ai.WinWait(File Download, , 5) //Here the first argument is the Title of pop-up window and thrid is the waiting time ai.ControlFocus(File Download, , Open) //First argument is same as described above,Third option for you can be OK or Cancel ai.ControlClick(File Download, , Open) //First argument is same as described above,Third option for you can be OK or Cancel For further help please revert back. Thanks Regards, Ankur Gera- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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: javascript
Thank you Ankur. On Aug 27, 2:11 pm, kumar gki...@gmail.com wrote: Hmmm...i got a solutionn to do it by using ControlGetText method Thanks, kiran. On Aug 27, 12:43 pm, kumar gki...@gmail.com wrote: Hi Ankur, Thank you very much for your reply. I dont want click on any button on popup. I want to verify the desired buttons are exist or not. Thanks, kiran. On Aug 27, 11:55 am, Ankur Gera ankurg...@gmail.com wrote: Hi Kumar, You can use the following code with the changes according to ur pop-up window: ai = WIN32OLE.new(AutoItX3.Control) ai.WinWait(File Download, , 5) //Here the first argument is the Title of pop-up window and thrid is the waiting time ai.ControlFocus(File Download, , Open) //First argument is same as described above,Third option for you can be OK or Cancel ai.ControlClick(File Download, , Open) //First argument is same as described above,Third option for you can be OK or Cancel For further help please revert back. Thanks Regards, Ankur Gera- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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: Modal dialog window opened from page_load event
Hi, Whenever there is a modal dialog during a page load, the wait method will be stuck till someone clicks on the OK or CANCEL to dismiss the modal dialog. The code will be stuck in the below while loop the wait method(ie- class.rb). begin while @ie.busy # XXX need to add time out sleep a_moment end ie.add_checker PageCheckers ::HANDLE_MODAL would also not work since run_error_checks would only work at the end of the wait method. You would have to make changes to the wait method in C:\ruby\lib\ruby \gems\1.8\gems\watir-1.6.2\lib\watir\ie-class.rb Replace the wait method with the below code - will also handle any security alert, security information, certificate error(ie 6) and return from the wait method when a popup window is loaded when in the busy while loop. http://pastie.org/596458 def wait(no_sleep=false) @rexmlDomobject = nil @down_load_time = 0.0 a_moment = 0.2 # seconds start_load_time = Time.now outval = ' ' * 30 popwndtitle = '' #puts CALLLED WAIT !!! begin while @ie.busy # XXX need to add time out sleep a_moment # 1-SECURITY INFORMATION - PAGE CONTAINS BOTH SECURE AND INSECURE ITEMS YES-6 # 2-Security Alert - Certificate error YES-1 pophwnd = Win32API.new(user32, GetWindow, 'Li', 'L').Call (@ie.hwnd.to_i, 6) # only handle if there is a popup and handle only 2 popups, if any other popups occur return. if pophwnd !=0 Win32API.new(user32, GetWindowText, 'Lpi', 'L').Call (pophwnd,outval,30) popwndtitle = outval.rstrip.chomp(\000) return 0 if !(popwndtitle.include?(Security Alert) || popwndtitle.include?(Security Information)) cntrlhwndYES = Win32API.new(user32, GetDlgItem, 'Li', 'L').Call(pophwnd, 1) Win32API.new(user32, SendMessage,'','L').Call (cntrlhwndYES, 0x0006, 1,0) Win32API.new(user32, SendMessage,'','L').Call (cntrlhwndYES, 0x00F5, 0,0) cntrlhwndYES = Win32API.new(user32, GetDlgItem, 'Li', 'L').Call(pophwnd, 6) Win32API.new(user32, SendMessage,'','L').Call (cntrlhwndYES, 0x0006, 1,0) Win32API.new(user32, SendMessage,'','L').Call (cntrlhwndYES, 0x00F5, 0,0) end end until @ie.readyState == READYSTATE_COMPLETE do sleep a_moment end sleep a_moment until @ie.document do sleep a_moment end documents_to_wait_for = [...@ie.document] rescue WIN32OLERuntimeError # IE window must have been closed @down_load_time = Time.now - start_load_time sleep @pause_after_wait unless no_sleep return @down_load_time end while doc = documents_to_wait_for.shift begin until doc.readyState == complete do sleep a_moment end @url_list doc.location.href unless @url_list.include? (doc.location.href) doc.frames.length.times do |n| begin documents_to_wait_for doc.frames[n.to_s].document rescue WIN32OLERuntimeError, NoMethodError end end rescue WIN32OLERuntimeError end end @down_load_time = Time.now - start_load_time run_error_checks sleep @pause_after_wait unless no_sleep @down_load_time end Let me know if you have any issues. 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] How to click the graybutton?
Dear All, I am an new user of Watir. Right now, I meet a issue that how to click the graybutton. Please see the attach,I support more info in the screenshot. Looks like this button is not a common button. I try the following following method,but it doesn't work. @browser.button(:value,Signup Now!).click I hope someone can give me a hand! If the info is not enough, go to the following website and you can find this button. https://ome.swimconnection.com Many thanks! -Zhong --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~--- attachment: How+to+click+graybutton.png
[wtr-general] Re: How to click the graybutton?
you need to write something like: @browser.link(:href, https://ome.swimconnection.com/ome/users/new;).click A indicates a link. Its not a button. -Prajakta On Thu, Aug 27, 2009 at 3:42 PM, yuping zhong littlezhong...@gmail.comwrote: Dear All, I am an new user of Watir. Right now, I meet a issue that how to click the graybutton. Please see the attach,I support more info in the screenshot. Looks like this button is not a common button. I try the following following method,but it doesn't work. @browser.button(:value,Signup Now!).click I hope someone can give me a hand! If the info is not enough, go to the following website and you can find this button. https://ome.swimconnection.com Many thanks! -Zhong --~--~-~--~~~---~--~~ 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
Sorry, I thought it was clear in my first post. The site is https://cdr.ffiec.gov/public/ManageFacsimiles.aspx I am trying to search through a list of Cert Codes. For each Cert Code, I want to download the file corresponding to each date present in the date dropdown list and click submit. On Aug 27, 3:19 am, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Thu, Aug 27, 2009 at 2:35 AM, Doodle jeffrey.eman...@gmail.com wrote: site (which, btw, is a public site for looking at detailed reports about banks), Can you send us a link and let us know what you want to do? Ž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] WATIR WITH QC INTEGRATION
Hi All, In my project as per my client requirement,I have to integrate Watir with QC. It would be great help if you have any suggestions and help in this regard. Please help me. Thanks, kiran. --~--~-~--~~~---~--~~ 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: How can I get the attribute in the attached?
What sort of information is the developer toolbar giving you? Have you tried using the :index attribute? On Aug 26, 8:38 pm, Eason nbkhic...@gmail.com wrote: Dear All, Please view the image in the attached. I want to get the arrtibute of the item Quality Management. The drop-down list is a div which is created by javascript, I try to use IE devolep tool to get the attribute of the item, but I find that it is impossible, when I use the tool onfocus to the item, the item will disappear, so I can not fetch the details of this item. Can anyone tell me how to get the attribute? Eason 2009-08-27 截图00.bmp 516KViewDownload --~--~-~--~~~---~--~~ 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: How can I get the attribute in the attached?
Dear George, The privious trouble has alreadly been clear, I use the Select Element by Click functon to get the attribute. But then a follow problem come in... In my test page, the drop down list are all div which were created by JS. I used click() method to click the item, but nothing happened, then I use click_no_wait() method, but it did not work yet. At last, I use fire_event() method just as following, but it also did not work! menu.div(:text, 'Internal Control System').fire_event(onMouseOver) menu.div(:text, 'Internal Control System').fire_event(onMouseDown) menu.div(:text, 'Internal Control System').fire_event(onClick) menu.div(:text, 'Internal Control System').fire_event(ondblclick) menu.div(:text, 'Internal Control System').click_no_wait Attached is the drop down list. PS: Is there a method can operate a right click? Eason 2009-08-28 发件人: George 发送时间: 2009-08-28 04:20:26 收件人: Watir General 抄送: 主题: [wtr-general] Re: How can I get the attribute in the attached? What sort of information is the developer toolbar giving you? Have you tried using the :index attribute? On Aug 26, 8:38 pm, Eason nbkhic...@gmail.com wrote: Dear All, Please view the image in the attached. I want to get the arrtibute of the item Quality Management. The drop-down list is a div which is created by javascript, I try to use IE devolep tool to get the attribute of the item, but I find that it is impossible, when I use the tool onfocus to the item, the item will disappear, so I can not fetch the details of this item. Can anyone tell me how to get the attribute? Eason 2009-08-27 截图00.bmp 516KViewDownload --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~--- attachment: 00.JPG
[wtr-general] Re: WATIR WITH QC INTEGRATION
Could you tell more detail your requirement? On Aug 28, 2:04 am, kumar gki...@gmail.com wrote: Hi All, In my project as per my client requirement,I have to integrate Watir with QC. It would be great help if you have any suggestions and help in this regard. Please help me. Thanks, kiran. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---