[wtr-general] Re: Iterate through radio buttons
Thank you! that's working. On Jul 1, 5:39 am, joedio joe...@comcast.net wrote: Shlomit, This may work for your situation: # Define the element ID to be acted upon myID = your_id # Loop through the radio elements browser.radios.each do | radio | # Separate the matching radios if(browser.radio(:id, myID )) # Do whatever you need to do with it (e.g. set it) browser.radio(:id, myID ).set end end # End of Loop Hope that helps, Joe On Jul 1, 5:08 am, Shlomit Gazit shlomitpatr...@gmail.com wrote: I am trying to iterate through radio buttons in the page, but I dont want to iterate through all the radios in the page, only those with certain id. How can I do that? -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Recent Stack Overflow Questions Tagged Watir
Initiate Button click action using Watir Ruby library http://stackoverflow.com/questions/3159354 Željko -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Iterate through radio buttons
Hello Joe, It is actually doesnt work. The condition is not working, it is still going through all the radio buttons. On Jul 2, 1:51 am, Shlomit Gazit shlomitpatr...@gmail.com wrote: Thank you! that's working. On Jul 1, 5:39 am, joedio joe...@comcast.net wrote: Shlomit, This may work for your situation: # Define the element ID to be acted upon myID = your_id # Loop through the radio elements browser.radios.each do | radio | # Separate the matching radios if(browser.radio(:id, myID )) # Do whatever you need to do with it (e.g. set it) browser.radio(:id, myID ).set end end # End of Loop Hope that helps, Joe On Jul 1, 5:08 am, Shlomit Gazit shlomitpatr...@gmail.com wrote: I am trying to iterate through radio buttons in the page, but I dont want to iterate through all the radios in the page, only those with certain id. How can I do that? -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Re: Save Download Box behaves differently on IE 6 and IE 7
Hi Joedio, Thanks for the reply. However, may I humbly submit that the titles have been hardcoded deliberately since they are the standard 'Save As', Download Complete' dialog boxes. Kindly suggest considering the titles as-is. Regards, Asheesh On Fri, Jul 2, 2010 at 3:27 AM, joedio joe...@comcast.net wrote: Asheesh, I see from the code you supplied that when running with IE6 you are passing to AutoIt one title as a variable... window_title = File Download ai.WinWaitActive(window_title,prompt_message,1) have another title hard coded as Save As ai.WinWait(Save As, Save in, 5) and another window's title hard coded as Download complete ai.ControlClick(Download complete, , Close) Have you manually verified that the titles of each those windows are exactly the same when opened via IE6 and IE7? If they are not identical then you can either add if/then statements, or perhaps use regular expressions to identify the windows in a manner that matches both IE6 and IE7 titles, to account for that difference. Joe On Jul 1, 10:34 am, asheesh misra asheeshmisr...@gmail.com wrote: Hi All, I am newbie in Ruby/ WATIR and am struggling for the past 4 days with a slightly uncommon problem. The application I am trying to automate has a feature of exporting the data table in .csv format. I use following function to save that exported .csv file: def SaveFileCorrectOne(filepath) ai = WIN32OLE::new('AutoItX3.Control') prompt_message = Do you want to open or save this file? window_title = File Download sleep 5 ai.WinWaitActive(window_title,prompt_message,1) ai.ControlFocus(window_title, prompt_message, Save) ai.ControlClick(window_title,prompt_message,4427) ai.WinWaitActive(Save As,Save in,2) ai.ControlSetText(Save As,Save in,1148,filepath) ai.ControlClick(window_title,prompt_message,Save) ai.WinWait(Save As, Save in, 5) ai.ControlClick(Save As, Save in,Save) ai.WinActivate(Save As,) ai.ControlFocus(Save As, , Yes) ai.ControlClick(Save As, , Yes,left) ai.WinWait(Download complete, , 1) ai.ControlClick(Download complete, , Close) end On IE 6, when this function is executed, the export process proceeds in the following manner: 1. Export Button is clicked. 2. Save As dialog box appears (and behind this dialog box appears a blank IE window.) 3. On saving the file (.csv file), the 'Download Complete' box is visible (and in the background the blank IE window is also visible). 4. On clicking the 'Close' button on the 'Download Complete' box, the box closes but the window doesn't close, and this hangs the script. On IE7, when the Export button is clicked, an IE window flashes and disappears, and the script moves ahead to the next task. The export of the .csv file doesn't take place. In other words, the SaveFile function never gets called. Can anyone please, please help me. Regards, Asheesh -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.comwatir-general%2bunsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Re: Iterate through radio buttons
On Fri, Jul 2, 2010 at 12:09 PM, Shlomit Gazit shlomitpatr...@gmail.com wrote: The condition is not working, it is still going through all the radio buttons. Joe's code if working fine. browser.radios.each means iterate over all radio buttons. Why do you insist on not iterating over all radio buttons? Speed? Željko -- watir.com - community manager watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them vidipodkast.com - pričamo o hardveru, softveru i časopisu Vidi -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Iterate through radio buttons
Hello Željko, Because I dont need to iterate over all radio buttons. I want to create an array of the innerText (or something else) of the 9 out of 16 radios on the page. Then I need to do something with every variable in this array. Shlomit On Jul 2, 4:34 am, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Fri, Jul 2, 2010 at 12:09 PM, Shlomit Gazit shlomitpatr...@gmail.com wrote: The condition is not working, it is still going through all the radio buttons. Joe's code if working fine. browser.radios.each means iterate over all radio buttons. Why do you insist on not iterating over all radio buttons? Speed? Željko -- watir.com - community manager watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them vidipodkast.com - pričamo o hardveru, softveru i časopisu Vidi -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Re: Iterate through radio buttons
2010/7/2 Shlomit Gazit shlomitpatr...@gmail.com I want to create an array of the innerText (or something else) of the 9 out of 16 radios on the page. Then I need to do something with every variable in this array. Then just iterate over all radio buttons and create an array that contains just the ones you want: original_array = [aa, bb, ab, ba] new_array = original_array.collect {|element| element if element =~ /a/ } = [aa, nil, ab, ba] # compact removes nil elements new_array.compact = [aa, ab, ba] Željko -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Save Download Box behaves differently on IE 6 and IE 7
That's good news, we can eliminate the title as a root cause in this case. Its an issue when running with Firefox, as Firefox appends the name of the file being saved to the dialog's title. I'm sorry but I only have IE8 available to me, but have seen many differences in behavior between IE6 IE7 when working for clients in the past, so I understand your frustration. Can you tell what spawns the blank IE window that opened and does NOT close with IE6 when the Download Complete dialog closes? Was it spawned by a step performed prior to calling this function? If the root case of what spawned that blank browser can't be eliminated try to attack the symptom it casused. Use AutoIt to attach to that extra blank window and close it. # Create an AutoIt object oAutoIt = WIN32OLE.new(AutoItX3.Control) # Presuming that the title of the window in question is: about:blank oAutoIt.WinClose(about:blank, ) This would at least get the code working with IE6 without hanging. Joe On Jul 2, 4:13 am, asheesh misra asheeshmisr...@gmail.com wrote: Hi Joedio, Thanks for the reply. However, may I humbly submit that the titles have been hardcoded deliberately since they are the standard 'Save As', Download Complete' dialog boxes. Kindly suggest considering the titles as-is. Regards, Asheesh On Fri, Jul 2, 2010 at 3:27 AM, joedio joe...@comcast.net wrote: Asheesh, I see from the code you supplied that when running with IE6 you are passing to AutoIt one title as a variable... window_title = File Download ai.WinWaitActive(window_title,prompt_message,1) have another title hard coded as Save As ai.WinWait(Save As, Save in, 5) and another window's title hard coded as Download complete ai.ControlClick(Download complete, , Close) Have you manually verified that the titles of each those windows are exactly the same when opened via IE6 and IE7? If they are not identical then you can either add if/then statements, or perhaps use regular expressions to identify the windows in a manner that matches both IE6 and IE7 titles, to account for that difference. Joe On Jul 1, 10:34 am, asheesh misra asheeshmisr...@gmail.com wrote: Hi All, I am newbie in Ruby/ WATIR and am struggling for the past 4 days with a slightly uncommon problem. The application I am trying to automate has a feature of exporting the data table in .csv format. I use following function to save that exported .csv file: def SaveFileCorrectOne(filepath) ai = WIN32OLE::new('AutoItX3.Control') prompt_message = Do you want to open or save this file? window_title = File Download sleep 5 ai.WinWaitActive(window_title,prompt_message,1) ai.ControlFocus(window_title, prompt_message, Save) ai.ControlClick(window_title,prompt_message,4427) ai.WinWaitActive(Save As,Save in,2) ai.ControlSetText(Save As,Save in,1148,filepath) ai.ControlClick(window_title,prompt_message,Save) ai.WinWait(Save As, Save in, 5) ai.ControlClick(Save As, Save in,Save) ai.WinActivate(Save As,) ai.ControlFocus(Save As, , Yes) ai.ControlClick(Save As, , Yes,left) ai.WinWait(Download complete, , 1) ai.ControlClick(Download complete, , Close) end On IE 6, when this function is executed, the export process proceeds in the following manner: 1. Export Button is clicked. 2. Save As dialog box appears (and behind this dialog box appears a blank IE window.) 3. On saving the file (.csv file), the 'Download Complete' box is visible (and in the background the blank IE window is also visible). 4. On clicking the 'Close' button on the 'Download Complete' box, the box closes but the window doesn't close, and this hangs the script. On IE7, when the Export button is clicked, an IE window flashes and disappears, and the script moves ahead to the next task. The export of the .csv file doesn't take place. In other words, the SaveFile function never gets called. Can anyone please, please help me. Regards, Asheesh -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.comwatir-general%2bunsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Iterate through radio buttons
Schlomit, Could you post the code you created from my example so folks can look at it to try to determine why the conditional is not working? Please include the output as well. Thanks, Joe On Jul 2, 5:59 am, Željko Filipin zeljko.fili...@wa-research.ch wrote: 2010/7/2 Shlomit Gazit shlomitpatr...@gmail.com I want to create an array of the innerText (or something else) of the 9 out of 16 radios on the page. Then I need to do something with every variable in this array. Then just iterate over all radio buttons and create an array that contains just the ones you want: original_array = [aa, bb, ab, ba] new_array = original_array.collect {|element| element if element =~ /a/ } = [aa, nil, ab, ba] # compact removes nil elements new_array.compact = [aa, ab, ba] Željko -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Dialog boxes..
Hi, Can Watir be used for automating windows applications??? Everyone obviously knows it could be used for automating web browser related activities. Thanks, Musheka On Mon, Jun 14, 2010 at 10:56 AM, Ramu Pillai mush...@gmail.com wrote: Hi Željko, Thanks a lot for your prompt reply. Mouth On Mon, Jun 14, 2010 at 9:22 AM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Mon, Jun 14, 2010 at 3:17 PM, Ramu Pillai mush...@gmail.com wrote: I need to work with dialog boxes in watir. Did you read this? http://wiki.openqa.org/display/WTR/Pop+Ups Željko -- watir.com - community manager watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them vidipodkast.com - pričamo o hardveru, softveru i časopisu Vidi -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.comwatir-general%2bunsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
RE: [wtr-general] Dialog boxes..
Watir for non-web applications? No. Ruby for non-web applications? Possibly. Couple of resources to consider: Scripted GUI Testing with Ruby by Ian Dees Everyday Scripting with Ruby by Brian Marick It all depends on what you're trying to do. (Not sure how this relates to dialog boxes unless they're contained within a Windows app. Methinx a separate thread would've been more meaningful for this question.) From: watir-general@googlegroups.com [mailto:watir-gene...@googlegroups.com] On Behalf Of Ramu Pillai Sent: Friday, July 02, 2010 1:12 PM To: watir-general@googlegroups.com Subject: Re: [wtr-general] Dialog boxes.. Hi, Can Watir be used for automating windows applications??? Everyone obviously knows it could be used for automating web browser related activities. Thanks, Musheka On Mon, Jun 14, 2010 at 10:56 AM, Ramu Pillai mush...@gmail.com wrote: Hi Željko, Thanks a lot for your prompt reply.  Mouth On Mon, Jun 14, 2010 at 9:22 AM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Mon, Jun 14, 2010 at 3:17 PM, Ramu Pillai mush...@gmail.com wrote: I need to work with dialog boxes in watir. Did you read this? http://wiki.openqa.org/display/WTR/Pop+Ups Željko -- watir.com http://watir.com/ - community manager watirpodcast.com http://watirpodcast.com/ - host testingpodcast.com http://testingpodcast.com/ - audio podcasts on software testing. all of them vidipodkast.com http://vidipodkast.com/ - pričamo o hardveru, softveru i časopisu Vidi -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice.  You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com mailto:watir-general%2bunsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Dialog boxes..
NO you can't use Watir for automating other Windows apps, you would use Ruby itself. If you want to automate Windows apps through their GUI API try using Ruby with AutoIt. Watir makes use of some of AutoIt's capabilities, but there is much more htat AutoIt can do. Suggest downloading the full AutoIt installer and brush up on its documentation. http://www.autoitscript.com/autoit3/index.shtml FYI: Current version of AutoIt includes additional fixes and functions that are not available in the version of the AutoIt library that's included in Watir1.6.5 If you want to automate a windows application you can also use Ruby to require/include a Dynamic Link Library (dll) and access the API's of the library. Joe On Jul 2, 12:20 pm, Jason Trebilcock jason.trebilc...@gmail.com wrote: Watir for non-web applications? No. Ruby for non-web applications? Possibly. Couple of resources to consider: Scripted GUI Testing with Ruby by Ian Dees Everyday Scripting with Ruby by Brian Marick It all depends on what you're trying to do. (Not sure how this relates to dialog boxes unless they're contained within a Windows app. Methinx a separate thread would've been more meaningful for this question.) From: watir-general@googlegroups.com [mailto:watir-gene...@googlegroups.com] On Behalf Of Ramu Pillai Sent: Friday, July 02, 2010 1:12 PM To: watir-general@googlegroups.com Subject: Re: [wtr-general] Dialog boxes.. Hi, Can Watir be used for automating windows applications??? Everyone obviously knows it could be used for automating web browser related activities. Thanks, Musheka On Mon, Jun 14, 2010 at 10:56 AM, Ramu Pillai mush...@gmail.com wrote: Hi Željko, Thanks a lot for your prompt reply.  Mouth On Mon, Jun 14, 2010 at 9:22 AM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Mon, Jun 14, 2010 at 3:17 PM, Ramu Pillai mush...@gmail.com wrote: I need to work with dialog boxes in watir. Did you read this? http://wiki.openqa.org/display/WTR/Pop+Ups Željko -- watir.com http://watir.com/ - community manager watirpodcast.com http://watirpodcast.com/ - host testingpodcast.com http://testingpodcast.com/ - audio podcasts on software testing. all of them vidipodkast.com http://vidipodkast.com/ - pričamo o hardveru, softveru i časopisu Vidi -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice.  You received this message because you are subscribed tohttp://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com mailto:watir-general%2bunsubscr...@googlegroups.com -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed tohttp://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com