[wtr-general] Re: Opening an Excel file with a variable name
More useful File.join($drive,env,Test_Results,#{$file_name}_Results.xls ) On 17 дек, 00:20, Darin Duphorn dduph...@redbrickhealth.com wrote: Try \\ $drive+\\+env+\\Test_Results\\+$file_name+_Results.xls -Original Message- From: watir-general@googlegroups.com [mailto:watir-gene...@googlegroups.com] On Behalf Of jas.shel...@hotmail.com Sent: Tuesday, December 16, 2008 3:08 PM To: Watir General Subject: [wtr-general] Opening an Excel file with a variable name All, I am attempting to open an Excel file with Ruby, and have run into a problem. If I open the file with single quotes, like inputFile = input.Workbooks.Open('C:\Folder\sheet.xls') everything works fine. My problem now is that the location of the .xls file has a variable name, like inputFile = input.Workbooks.Open(C:\#{var)\sheet.xls). When I try this, I get an error saying that the file cannot be found. It seems that the 'open' method will only work with single quotes, but to signify a variable in a string in Ruby you have to use double quotes. Has anyone discovered a way around this? Thanks in advance for any help. - Shelton --~--~-~--~~~---~--~~ 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 to handle file download popups in Firefox?
Hi al3kc, THANK YOU very much. Your code snippet worked great the very first time. I just had to modify it a little for my use, but worked just fine. I was having another question regarding the file download popup and was wondering if you could help with some advice. How to handle the radio buttons (Open with and Save File) in the popup. The default being Save File works for me now. But how do I choose the other option? Also how to check a check box in the popup. Thank you very much once again. Margam On Dec 17, 2:41 am, al3kc aleks.kiev...@gmail.com wrote: Hi, I use next code and it works for me �...@ai = WIN32OLE.new(AutoItX3.Control) �...@ai.winwaitactive([REGEXPTITLE:Opening]) �...@ai.send({ENTER}) �...@ai.winwait(Enter name of file to save to…, , 5) �...@ai.winactivate(Enter name of file to save to…) sleep(7) �...@ai.send(#{$test_directory}\\#{name}) sleep(5) �...@ai.controlclick(Enter name of file to save to…, , Save) sleep(1) To print path for saving I use @ai.Send(#{$test_directory}\\# {name}) instead of ai.ControlSend(Enter name of file to save to..., , Edit,filepath) because this always type massed 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: Opening an Excel file with a variable name
I discovered that my problem was that I had a newline character at the end of each array element. Once I removed the character, it worked fine. Thanks for your help. - Shelton Date: Wed, 17 Dec 2008 10:02:11 -0600 From: b...@pettichord.com To: watir-general@googlegroups.com Subject: [wtr-general] Re: Opening an Excel file with a variable name Actually this method won't work. The problem is that File.join will join the elements using a forward slash (/). The pathname is being passed to Excel, which truly requires that backslashes be used in the filename. I've argued that this is a bug in Ruby, but there it is. Bret LFIdnl wrote: More useful File.join($drive,env,Test_Results,#{$file_name}_Results.xls ) On 17 дек, 00:20, Darin Duphorn dduph...@redbrickhealth.com wrote:Try \\ $drive+\\+env+\\Test_Results\\+$file_name+_Results.xls -Original Message- From: watir-general@googlegroups.com [mailto:watir-gene...@googlegroups.com] On Behalf Of jas.shel...@hotmail.com Sent: Tuesday, December 16, 2008 3:08 PM To: Watir General Subject: [wtr-general] Opening an Excel file with a variable name All, I am attempting to open an Excel file with Ruby, and have run into a problem. If I open the file with single quotes, like inputFile = input.Workbooks.Open('C:\Folder\sheet.xls') everything works fine. My problem now is that the location of the .xls file has a variable name, like inputFile = input.Workbooks.Open(C:\#{var)\sheet.xls). When I try this, I get an error saying that the file cannot be found. It seems that the 'open' method will only work with single quotes, but to signify a variable in a string in Ruby you have to use double quotes. Has anyone discovered a way around this? Thanks in advance for any help. - Shelton _ Send e-mail faster without improving your typing skills. http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008 --~--~-~--~~~---~--~~ 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: button.Click_No_Wait only highlights the button, does not click
I tried, even change the security of IE to Low, but the click_no_wait still cannot click the button. Now I just want to know what's the problem. Is it my IE's problem or Ruby's problem? On Dec 17, 11:53 am, Michael Hwee michael_h...@yahoo.com wrote: Come and think of that, have you ever got successful dismissing any other popup? If I were you, I would be checking the browser configuration settings. Michael - Original Message From: Fish hhfish...@hotmail.com To: Watir General watir-general@googlegroups.com Sent: Tuesday, December 16, 2008 5:21:33 PM Subject: [wtr-general] Re: button.Click_No_Wait only highlights the button, does not click I use the ruby186-26,but still can not handle the popup...Just only block at the commandline. Does someone kindly do me a favor to provide code which can handle the modaldialog?I very appreciate it. I have tried below, but it doestn't work. @ie.button(:value, New).click_no_wait #pop up a modaldialog, by the methodshowmodaldialog sleep(3) hwnd = @ie.enabled_popup(10) @ie1 = @ie.modal_dialog(:title, 'RFQ') The error like this: c:/ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.2/lib/watir/waiter.rb: 59:in `wait _until': Timed out after 10.032 seconds. (Watir::Exception::TimeOutException) On Dec 16, 7:53 am, HAHAHA windchillfigh...@gmail.com wrote: I tried. The click_no_wait still cannot click the button. I think maybe it is really the configure problem. I use XP SP3, ruby186-27, watir1.6.2. Do you think some earlier version will be better? I know some programs cannot run in current version, like rubyscript2exe.rb. On Dec 16, 3:49 am, pramod D petkar.pra...@gmail.com wrote: Hi, I worked with your code and it is working fine, Only thing you need to do is introduce sleep(5) just before clicking the button. It will handle the pop up. Thanks, Pramod On Mon, Dec 15, 2008 at 8:57 PM, HAHAHA windchillfigh...@gmail.com wrote: 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_alerthttp://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
[wtr-general] Re: How to handle file download popups in Firefox?
Hi, I use next code and it works for me @ai = WIN32OLE.new(AutoItX3.Control) @ai.WinWaitActive([REGEXPTITLE:Opening]) @ai.Send({ENTER}) @ai.WinWait(Enter name of file to save to…, , 5) @ai.WinActivate(Enter name of file to save to…) sleep(7) @ai.Send(#{$test_directory}\\#{name}) sleep(5) @ai.ControlClick(Enter name of file to save to…, , Save) sleep(1) To print path for saving I use @ai.Send(#{$test_directory}\\# {name}) instead of ai.ControlSend(Enter name of file to save to..., , Edit,filepath) because this always type massed 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: Opening an Excel file with a variable name
I have tried both proposed methods, and I am getting the same 'File not found' error. It seems that Ruby has a problem with using variables in certain scenarios. Previously, I was passing a parameter to a class named 'Test' with a function in it named 'go'. This is the syntax that I used, Test.new.go('hello') The function 'go' would open a .xls file with the parameter in the path, such as C:\hello\data.xls. Everything was working fine then. Now, instead of using the actual string 'hello' as the parameter, I am using an array element variable, so the syntax is Test.new.go(array[x]). Now the 'go' function throws the ''File not found' error. In the error message, both the path and file are correct, so I do not understand why the file cannot be found. Does anyone have any idea about what could be going on? Thanks in advance for any help. - Shelton Date: Wed, 17 Dec 2008 00:36:06 -0800 Subject: [wtr-general] Re: Opening an Excel file with a variable name From: sraniim...@gmail.com To: watir-general@googlegroups.com More useful File.join($drive,env,Test_Results,#{$file_name}_Results.xls ) On 17 дек, 00:20, Darin Duphorn dduph...@redbrickhealth.com wrote: Try \\ $drive+\\+env+\\Test_Results\\+$file_name+_Results.xls -Original Message- From: watir-general@googlegroups.com [mailto:watir-gene...@googlegroups.com] On Behalf Of jas.shel...@hotmail.com Sent: Tuesday, December 16, 2008 3:08 PM To: Watir General Subject: [wtr-general] Opening an Excel file with a variable name All, I am attempting to open an Excel file with Ruby, and have run into a problem. If I open the file with single quotes, like inputFile = input.Workbooks.Open('C:\Folder\sheet.xls') everything works fine. My problem now is that the location of the .xls file has a variable name, like inputFile = input.Workbooks.Open(C:\#{var)\sheet.xls). When I try this, I get an error saying that the file cannot be found. It seems that the 'open' method will only work with single quotes, but to signify a variable in a string in Ruby you have to use double quotes. Has anyone discovered a way around this? Thanks in advance for any help. - Shelton _ You live life online. So we put Windows on the web. http://clk.atdmt.com/MRT/go/127032869/direct/01/ --~--~-~--~~~---~--~~ 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 to click on a grid cell to sort?
Have you tried th.click ? It is a standard tag, so it doesn't seem logical that th wouldn't be supported by Watir, but I could be wrong. On Wed, Dec 17, 2008 at 1:11 PM, maven999 maven...@gmail.com wrote: Hi, I have a dojo grid that I want to sort by column. The grid has 2 header cells named stat_name and stat_value. The header cell by default does not have a 'sort' arrow that I can click. The sort button becomes visible when I click on the header cell the first time, after which I can sort up or down. The html source for the header cell (with text 'stat_name' or 'stat_value') is: DIV class=dojoxGrid id=dbGrid DIV class=dojoxGrid-master-header DIV class=dojoxGrid-header TABLE class=dojoxGrid-row-table TBODY _zipIdx=22 unselectable=on TH class=dojoxGrid-cell style=WIDTH: 11.89em _zipIdx=22 role=wairole:columnheader unselectable=on idx=0stat_name/TD _zipIdx=22 unselectable=on//TD /TH TH class=dojoxGrid-cell style=WIDTH: 16.79em _zipIdx=22 role=wairole:columnheader unselectable=on idx=1stat_value/TD _zipIdx=22 unselectable=on//TD/TR _zipIdx=22 unselectable=on//TR /TH /TBODY /TABLE /DIV /DIV /DIV /DIV As far as I know, Watir does not support a TH tag. Any idea on how I can locate this header cell and click it? Thanks! -- Nathan Lane Home, http://www.nathandelane.com Blog, http://nathandelane.blogspot.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: How to click on a grid cell to sort?
I use the following line to locate the cell: $ie.div(:id, 'dbGrid').div(:class, 'dojoxGrid-master-header').table (:class, 'dojoxGrid-row-table').th(:text, 'stat_name').click I get the following error on console: 1) Error: test_Statistics(TC_UI): NoMethodError: undefined method `th' for #Watir::Table:0x3726a5c C:/ruby/test/Ian.rb:165:in `test_Statistics' 1 tests, 0 assertions, 0 failures, 1 errors On Dec 17, 4:13 pm, Nathan Lane nathamberl...@gmail.com wrote: Have you tried th.click ? It is a standard tag, so it doesn't seem logical that th wouldn't be supported by Watir, but I could be wrong. On Wed, Dec 17, 2008 at 1:11 PM, maven999 maven...@gmail.com wrote: Hi, I have a dojo grid that I want to sort by column. The grid has 2 header cells named stat_name and stat_value. The header cell by default does not have a 'sort' arrow that I can click. The sort button becomes visible when I click on the header cell the first time, after which I can sort up or down. The html source for the header cell (with text 'stat_name' or 'stat_value') is: DIV class=dojoxGrid id=dbGrid DIV class=dojoxGrid-master-header DIV class=dojoxGrid-header TABLE class=dojoxGrid-row-table TBODY _zipIdx=22 unselectable=on TH class=dojoxGrid-cell style=WIDTH: 11.89em _zipIdx=22 role=wairole:columnheader unselectable=on idx=0stat_name/TD _zipIdx=22 unselectable=on//TD /TH TH class=dojoxGrid-cell style=WIDTH: 16.79em _zipIdx=22 role=wairole:columnheader unselectable=on idx=1stat_value/TD _zipIdx=22 unselectable=on//TD/TR _zipIdx=22 unselectable=on//TR /TH /TBODY /TABLE /DIV /DIV /DIV /DIV As far as I know, Watir does not support a TH tag. Any idea on how I can locate this header cell and click it? Thanks! -- Nathan Lane Home,http://www.nathandelane.com Blog,http://nathandelane.blogspot.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 Training now available
If you are interested in training on Watir, including the new framework that is in the works, WatirCraft is offering a two-day public class in Austin March 25-26, 2009. Private on-site training is also available. http://www.watircraft.com/watir-training/ Apologies if the commercial nature of this message offends anyone... feel free to ignore. --~--~-~--~~~---~--~~ 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: button.Click_No_Wait only highlights the button, does not click
I used to have the same problem, then I uninstalled my Ruby and Watir, then installed them again and the problem got fixed. You may want to try that too, use admin account to install Ruby (v.1.8.6-26), then install Watir, good luck! -Original Message- From: watir-general@googlegroups.com [mailto:watir-gene...@googlegroups.com] On Behalf Of HAHAHA Sent: Wednesday, December 17, 2008 12:50 PM To: Watir General Subject: [wtr-general] Re: button.Click_No_Wait only highlights the button, does not click I tried, even change the security of IE to Low, but the click_no_wait still cannot click the button. Now I just want to know what's the problem. Is it my IE's problem or Ruby's problem? On Dec 17, 11:53 am, Michael Hwee michael_h...@yahoo.com wrote: Come and think of that, have you ever got successful dismissing any other popup? If I were you, I would be checking the browser configuration settings. Michael - Original Message From: Fish hhfish...@hotmail.com To: Watir General watir-general@googlegroups.com Sent: Tuesday, December 16, 2008 5:21:33 PM Subject: [wtr-general] Re: button.Click_No_Wait only highlights the button, does not click I use the ruby186-26,but still can not handle the popup...Just only block at the commandline. Does someone kindly do me a favor to provide code which can handle the modaldialog?I very appreciate it. I have tried below, but it doestn't work. @ie.button(:value, New).click_no_wait #pop up a modaldialog, by the methodshowmodaldialog sleep(3) hwnd = @ie.enabled_popup(10) @ie1 = @ie.modal_dialog(:title, 'RFQ') The error like this: c:/ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.2/lib/watir/waiter.rb: 59:in `wait _until': Timed out after 10.032 seconds. (Watir::Exception::TimeOutException) On Dec 16, 7:53 am, HAHAHA windchillfigh...@gmail.com wrote: I tried. The click_no_wait still cannot click the button. I think maybe it is really the configure problem. I use XP SP3, ruby186-27, watir1.6.2. Do you think some earlier version will be better? I know some programs cannot run in current version, like rubyscript2exe.rb. On Dec 16, 3:49 am, pramod D petkar.pra...@gmail.com wrote: Hi, I worked with your code and it is working fine, Only thing you need to do is introduce sleep(5) just before clicking the button. It will handle the pop up. Thanks, Pramod On Mon, Dec 15, 2008 at 8:57 PM, HAHAHA windchillfigh...@gmail.com wrote: 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_alerthttp://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
[wtr-general] Re: Calling Javascript function from WATIR
Hi Vivek, Yes you can call javascript functions from watir - The method is execScript, you can call any javascript method or variable available in the webpage. eg: ienw = Watir::IE.new ienw.document.parentWindow.execScript(alert(\hi\)) Firewatir too has a method to execute javascript calls - js_eval ffnew = FireWatir::Firefox.new ffnew.js_eval(document.cookie) -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 -~--~~~~--~~--~--~---