Re: [Wtr-general] Javascript Problem....
On 11/25/06, san [EMAIL PROTECTED] wrote: @ Zeljko : Yes, But I Wanted The Whole Process... i.e opening The 1st Page, Entering My Given Data, Then Logging In... In The Background.i.eWhen IE Will Open The Page,I'll Be Already Logged In... Sanju, I do not understand what you want to do. Can you explain it further? Zeljko -- zeljkofilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] activeElement error.
Could you send the code that you use to click that link? Zeljko -- zeljkofilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] A special `method_missing':
On 11/26/06, Allen Zhou [EMAIL PROTECTED] wrote: So what shall I do? Use 'begin..rescue..end' to ignore this exception? If your script works and that exception just bugs you, rescuing it sounds like a good idea. Zeljko -- zeljkofilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Can Watir Download .html Pages...?
Look At This Code Please... [i]ie = Watir::IE.new ie.goto('http://www.something.com') ie.text_field(:name, userid1).set(.) ie.text_field(:name, userpass).set(.) ie.image(:src, /login/).click[/i] Now Obviously After The Click A Page Opens. My Question Is, Is It Possible To Save The Page As .html Or Is It Possible To Get All The Links In That Page Including Its Own url Using Watir Save As An Array? - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5451messageID=15186#15186 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can Watir Download .html Pages...?
On 11/27/06, san [EMAIL PROTECTED] wrote: Is It Possible To Save The Page As .html ie.html will show you html of the page: Or Is It Possible To Get All The Links In That Page ie.links is array of all links at that page Including Its Own url ie.url will give you url of page -- Zeljko Filipin zeljkofilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Is there a way to make file_field.set faster?
Is there a way to make file_field.set faster? I have noticed that this is the slowest part of my tests. It takes about 10 seconds to set file field. I have read that it can not be set directly because that would be security issue, but I wonder what I could do to make it faster. I upload extremely small files (a few bytes), but I have to do it frequently, and every time it takes about 10 seconds just to set file field. Any help would be appreciated. Thanks. -- Zeljko Filipin zeljkofilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Parameterization
I do not know how to use Excel, but this is how you could simplify your code (tested). searches = [pickaxe, Ruby, Watir, Watir and Ruby] searches.each do |search| ie.text_field(:name, q).set(search) ie.button(:name, btnG).click end -- Zeljko Filipin zeljkofilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can Watir Download .html Pages...?
Thanks [b]Zeljko[/b] But How Can I Save All These Links In An Array Of Strings? Will It Work? webs = ie.links webs.each do |web| puts web end Can You Tell Me From Where Can I Get All These Watir Functions...? Is There Any Good Quality Tutorial? - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5451messageID=15191#15191 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can Watir Download .html Pages...?
On 11/27/06, san [EMAIL PROTECTED] wrote: Will It Work? webs = ie.links webs.each do |web| puts web end Try it and you will see if it works. :) Can You Tell Me From Where Can I Get All These Watir Functions...? Is There Any Good Quality Tutorial? http://www.openqa.org/watir/watir_user_guide.html http://en.wikipedia.org/wiki/Watir http://wtr.rubyforge.org/rdoc/index.html http://www.openqa.org/watir/ http://wtr.rubyforge.org/ -- Zeljko Filipin zeljkofilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can Watir Download .html Pages...?
lol lol :) Ya It Worked... But I can't Open The Links Again by webs = ie.links webs.each do |web| ie.goto(web) # This Line Produces Error... I Also Tried web.to_s output.puts(ie.html) # output is a .html file to be opened in w mode end In Fact I Wanna Save All The Linked html Pages in my HDD. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5451messageID=15195#15195 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can Watir Download .html Pages...?
On 11/27/06, san [EMAIL PROTECTED] wrote: Ya It Worked... But I can't Open The Links Again by webs = ie.links webs.each do |web| ie.goto(web) # This Line Produces Error... I Also Tried web.to_s output.puts(ie.html) # output is a .html file to be opened in w mode end If you posted your error I could say more. In any case this will open all links in separate windows ie.links.each {|link| Watir::IE.start(link.href)} In Fact I Wanna Save All The Linked html Pages in my HDD. Saving pages with ie.html would not save pictures. You should use some other tool to do it. -- Zeljko Filipin zeljkofilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Parameterization
I suggest that you can use CSV or XML rather than Excel, because the Watir's script won't execute if your machines haven't installed Excel. On 11/27/06, Željko Filipin [EMAIL PROTECTED] wrote: I do not know how to use Excel, but this is how you could simplify your code (tested). searches = [pickaxe, Ruby, Watir, Watir and Ruby] searches.each do |search| ie.text_field(:name, q).set(search) ie.button(:name, btnG).click end -- Zeljko Filipin zeljkofilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general -- Please give me a reply if you recevied the mail. Thanks. Best Regards Jackei.Chan (Software Testing Consultant) [EMAIL PROTECTED] Chinese Blog: http://jackei.cnblogs.com/ English Blog: http://www.testingreflections.com/blog/3424 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Table has no unique attributes
You could also just use table index. If you do a view source on the page, then do a ctrlf. Beginning at the top of the page, put 'table' (without quotes) into the search field and begin counting by clicking the next button. When you get to desired table that 'count' number is your table index (it is 1 based). I have found this to much more reliable then xpath-which I have never been able to get to work correctly. Hope this helps, --Mark From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Angrez Singh Sent: Thursday, November 23, 2006 9:46 PM To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] Table has no unique attributes Hi, I think you can select the element using class attribute. Else you can use xpath for selecting the element using any attribute that uniquely identifies that element on the page. This all is available in watir releases greater than 1.4.1. Regards, Angrez On 11/23/06, Garry West [EMAIL PROTECTED] wrote: I am quite new to watir and I am currently trying to automate some tests, however I am having difficulties clicking on a link within a cell in a table. I have done this before however this table has no name or id, Infact the only thing I have to identify the table is a class. I am assuming that I am not the first person to encounter this issue and I'm hoping that someone knows how to get around this problem. Anyone got any ideas?? Regards Garry West Trainee Test Analyst InPS Tel: 01382 564313 Visit our Web site at www.inps.co.uk The information in this internet email is confidential and is intended solely for the addressee. Access, copying or re-use of information in it by anyone else is not authorised. Any views or opinions presented are solely those of the author and do not necessarily represent those of In Practice Systems Limited or any of its affiliates. If you are not the intended recipient please contact [EMAIL PROTECTED] P please don't print this e-mail unless you really need to. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] WATIR Bug on Vista
Whenever I try to run a WATIR script on Vista I encounter the following error, only after a new IE window appears. I believe that it is failing when trying to navigate to a page. Also, I am running the development gem 1.5.1.1100 as you can see in the error message. Started c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir.rb:1550: [BUG] Segmentation fault ruby 1.8.5 (2006-08-25) [i386-mswin32] This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Is there a way to make file_field.set faster?
Zeljko, this works for me and it is much faster because it uses the handle of the object. require 'watir/contrib/enabled_popup' $path = C\:\\watir_bonus\\working\\MyDoc.txt def startClicker( button , waitTime=5, user_input=nil) hwnd = $ie.enabled_popup(waitTime) # get a handle if one exists if (hwnd) # yes there is a popup w = WinClicker.new if ( user_input ) w.setTextValueForFileNameField(hwnd, #{user_input}) end sleep 3 # I put this in to see the text being input it is not necessary to work w.clickWindowsButton_hwnd(hwnd, #{button}) # OK or whatever the name on the button is w=nil# this is just cleanup end end # this is whatever invokes the file field dialog adoc = $ie.frame(main).image(:src, https://alinea.inmar.com/alinea/images/adddocument.gif;) adoc.click_no_wait # call the clicker startClicker( 'Open', 9, $path) --Mark From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Željko Filipin Sent: Monday, November 27, 2006 2:57 AM To: Watir Subject: [Wtr-general] Is there a way to make file_field.set faster? Is there a way to make file_field.set faster? I have noticed that this is the slowest part of my tests. It takes about 10 seconds to set file field. I have read that it can not be set directly because that would be security issue, but I wonder what I could do to make it faster. I upload extremely small files (a few bytes), but I have to do it frequently, and every time it takes about 10 seconds just to set file field. Any help would be appreciated. Thanks. -- Zeljko Filipin zeljkofilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] ie.minimize broken in watir-1.5.1.1127
Zeljko, I just ran through the same steps you list below and didn't have a problem. The use of autoit for controlling the window state of ie hasn't changed for quite some time and should be installed as part of your install. Is it working with previous gems on the same machine? -Charley On 11/22/06, Željko Filipin [EMAIL PROTECTED] wrote: I have just installed watir-1.5.1.1127.gem and it crashes when I use ie.minimize. I do not have autoit installed. Does watir require it now? Should I log this to jira? Steps to reproduce: C:\Documents and Settings\limitedruby -v ruby 1.8.5 (2006-08-25) [i386-mswin32] C:\Documents and Settings\limitedirb irb(main):001:0 require 'watir' = true irb(main):002:0 Watir::IE::VERSION = 1.5.1.1127 irb(main):003:0 ie = Watir::IE.start(http://www.google.com/;) = #Watir::IE:0x2e23130 ... irb(main):004:0 ie.minimize WIN32OLERuntimeError: Failed to create WIN32OLE object from `AutoItX3.Control' HRESULT error code:0x8007007e The specified module could not be found. from C:/ruby/lib/ruby/gems/1.8/gems/watir- 1.5.1.1127/./watir.rb:4356:in `initialize' from C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1127/./watir.rb:4356:in `new' from C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1127/./watir.rb:4356:in `autoit' from C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1127/./watir.rb:1644:in `autoit' from C:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1127/./watir.rb:1641:in `set_window_state' from C:/ruby/lib/ruby/gems/1.8/gems/watir- 1.5.1.1127/./watir.rb:1622:in `minimize' from (irb):4 Zeljko -- zeljkofilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Is there a way to make file_field.set faster?
you might also try setting focus to the filename field , and then using autoit to set the filename. Zeljko, this works for me and it is much faster because it uses the handle of the object. require 'watir/contrib/enabled_popup' $path = C\:\\watir_bonus\\working\\MyDoc.txt def startClicker( button , waitTime=5, user_input=nil) hwnd = $ie.enabled_popup(waitTime) # get a handle if one exists if (hwnd) # yes there is a popup w = WinClicker.new if ( user_input ) w.setTextValueForFileNameField(hwnd, #{user_input}) end sleep 3 # I put this in to see the text being input it is not necessary to work w.clickWindowsButton_hwnd(hwnd, #{button}) # OK or whatever the name on the button is w=nil# this is just cleanup end end # this is whatever invokes the file field dialog adoc = $ie.frame(main).image(:src, https://alinea.inmar.com/alinea/images/adddocument.gif;) adoc.click_no_wait # call the clicker startClicker( 'Open', 9, $path) --Mark From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Željko Filipin Sent: Monday, November 27, 2006 2:57 AM To: Watir Subject: [Wtr-general] Is there a way to make file_field.set faster? Is there a way to make file_field.set faster? I have noticed that this is the slowest part of my tests. It takes about 10 seconds to set file field. I have read that it can not be set directly because that would be security issue, but I wonder what I could do to make it faster. I upload extremely small files (a few bytes), but I have to do it frequently, and every time it takes about 10 seconds just to set file field. Any help would be appreciated. Thanks. -- Zeljko Filipin zeljkofilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can Watir Download .html Pages...?
And Can You Tell Me Any Other Way To Save .html Pages Intact. Take a look at http://forums.openqa.org/message.jspa?messageID=14044#14044 There is some code that can be used to save the page as rendered. (I believe that ei.html only will give you the page as downloaded.) ~~ Egil - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5451messageID=15209#15209 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Parameterization
On 11/27/06, sikander [EMAIL PROTECTED] wrote: could u expalin me how to do that in detail? -- *From:* [EMAIL PROTECTED]jackei** I suggest that you can use CSV or XML I suggest that you use yaml (http://yaml4r.sourceforge.net/cookbook/). I use it. -- Zeljko Filipin zeljkofilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] WATIR Bug on Vista
I don't have access to a Vista system and haven't tried running scripts on it. What scripts are you trying to run and where is the error? Does this happen if you simply open irb and do something like this: irb require 'watir' irb include Watir irb ie = IE.start('http://www.google.com') Or is there something further going on? I'd guess this doesn't really have much to do with Vista, but I've been mistaken before. More information might help track this down. -Charley On 11/27/06, Wyatt Preul [EMAIL PROTECTED] wrote: Whenever I try to run a WATIR script on Vista I encounter the following error, only after a new IE window appears. I believe that it is failing when trying to navigate to a page. Also, I am running the development gem 1.5.1.1100 as you can see in the error message. Started c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir.rb:1550: [BUG] Segmentation fault ruby 1.8.5 (2006-08-25) [i386-mswin32] This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can Watir Download .html Pages...?
I think you're looking for wget; Google it. ---Michael B. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of san Sent: November 27, 2006 11:55 AM To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] Can Watir Download .html Pages...? It Says That It Needs An Absolute Path In ie.goto(), It Cant Recognize The Array Elements Named [i]web[/i] Here And Can You Tell Me Any Other Way To Save .html Pages Intact. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5451messageID=15202#15202 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] WATIR Bug on Vista
To me this looks like a known problem with Watir and Ruby 1.8.5, and unrelated to Vista. I suggest you try Ruby 1.8.2. http://jira.openqa.org/browse/WTR-86 Please let us know if this fixes your problem. Bret Wyatt Preul wrote: Whenever I try to run a WATIR script on Vista I encounter the following error, only after a new IE window appears. I believe that it is failing when trying to navigate to a page. Also, I am running the development gem 1.5.1.1100 as you can see in the error message. Started c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir.rb:1550: [BUG] Segmentation fault ruby 1.8.5 (2006-08-25) [i386-mswin32] This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] activeElement error.
Any of the following works to click on the link: $ie.image(:id, popupImage1).click $ie.image(:src, /button_arrows_round/).click $ie.link(:id, ID_OPEN_POPUP1).click The result is the same, right button is flashed when used with .flash and they all open the right window - BUT! Second time, after you open it manually at least once. I even tried fireEvent(onClick) - same thing. Galina. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Galina Maralina Sent: Sunday, November 26, 2006 4:38 PM To: wtr-general@rubyforge.org Subject: [Wtr-general] activeElement error. Hello, I encountered a difference between Watir behavior and manual clicking on the link that is a problem for automated testing of the hole application. Here is my button/link/image, clicking on it opens a popup window: a id=ID_OPEN_POPUP1 href=#1 onclick=javascript:setDirtyFlag();activeElementGeneralizor(this);generi cPopupDelegator(1, 'POPUP_IDS1', 2, 'POPUP_IDS1', 'str_criteriaValuesInput1');return false;img id=popupImage1 src=/c2p/images/buttons/button_arrows_round15.gif width=15 height=15 hspace=3 border=0 valign=absmiddle //a When I try to open a popup window for the first time after the page loaded, I can do it manually, but Water does not open it, though no error is reported by Watir itself. There is an error in Javascript on the page that says: Member not found. If I open this popup manually first time, then I can use Watir to continue working with the page and it will open this same popup. When our developers tried to debug the error, they saw, that it is connected to using an activeElement in Javascript, they thought that, may be, Watir does not support some of it's methods. Here is the code that tested it: function activeElementGeneralizor(focusedElement){//TODO release this 'hack'! //test alert(activeElementGeneralizor(+focusedElement+));//test var message = originally supported; // if(!document.activeElement){ try{ alert(activeElement:+document.activeElement.toString()); document.activeElement=focusedElement;//TSU44 11192006: This may be the code that Watia can not execute... }catch(e){ alert(activeElement error:+e.description); t alert(activeElement:+document.activeElement.toString()); // Document.prototype.activeElement = new HTMLElement; // document.activeElement = focusedElement; } message = modified; //} //test alert(document.activeElement+(+message+)); } When running manually, the alert would point to url; when tested with Watir alert was activeElement:[object] and activeElement error: Member not found. I do need to open this popup in order to run tests, so if you know, what can be done, please, help me. Thank you, Galina Maralina. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] how to tell when IE is *really* done
I'm having trouble getting a script to tell me accurately when a page has finished rendering. I'm running Watir 1.4.1 with Ruby 1.8.5 on Windows XP Pro SP2. I'm clicking a link that opens a new browser window, then I attach to the window. The attach returns before the contents of the window are rendered. There is a lot of javascript processing going on to do the rendering - I'm guessing that IE is saying it's done when the code and data are all downloaded, even though Javascript is still executing. Adding extra calls to the wait method doesn't help - IE insists that it's no longer busy, according to ie.busy. The rendering can take 30 seconds or more. Can anyone suggest a way to determine when the page has been completely rendered? Or when Javascript code is not currently executing? The best idea I've had so far, which isn't a very good idea, is to use a heuristic to watch for some element of the page to appear in the document. In my case, this would require traversing a quagmire of nested frames to find the content. -Danny ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] how to tell when IE is *really* done
I this that this patch might fix this problem: http://jira.openqa.org/browse/WTR-107 I believe that a correct wait procedure needs to check every frame. Bret Danny R. Faught wrote: I'm having trouble getting a script to tell me accurately when a page has finished rendering. I'm running Watir 1.4.1 with Ruby 1.8.5 on Windows XP Pro SP2. I'm clicking a link that opens a new browser window, then I attach to the window. The attach returns before the contents of the window are rendered. There is a lot of javascript processing going on to do the rendering - I'm guessing that IE is saying it's done when the code and data are all downloaded, even though Javascript is still executing. Adding extra calls to the wait method doesn't help - IE insists that it's no longer busy, according to ie.busy. The rendering can take 30 seconds or more. Can anyone suggest a way to determine when the page has been completely rendered? Or when Javascript code is not currently executing? The best idea I've had so far, which isn't a very good idea, is to use a heuristic to watch for some element of the page to appear in the document. In my case, this would require traversing a quagmire of nested frames to find the content. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] WATIR Bug on Vista
The fix was found at http://jira.openqa.org/browse/WTR-86 The solution is to copy win32ole.so from C:\ruby\lib\ruby\1.8\i386-mswin32 to C:\ruby\lib\ruby\gems\1.8\gems\watir-1.5.1.1100\watir\win32ole ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] How do I write to simple file instead of screen?
I am new to Watir, and am trying to build a small demo for management. Can someone give me a quick example on replacing 'puts' with the command that writes instead to a file? My DOS window closes immediately upon completion of running a script and I can't see the results. Also, it there a 'pause' command or something similar? I tried using the example on wikipedia.com for writing to an excel sheet, but it never opened an excel sheet or wrote anything to it. Thanks, Stacaz - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5462messageID=15228#15228 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How do I write to simple file instead of screen?
Here is what I have so far. It opens the Excel sheet, but doesn't write anything to it. require 'watir' # the watir controller require 'win32ole' # set a variable test_site = 'http://www.google.com' result1 = 'Default' # open the IE browser ie = Watir::IE.new # print some comments puts ## Beginning of test: Google search puts puts Step 1: go to the test site: + test_site ie.goto(test_site) puts Action: entered + test_site + in the address bar. puts Step 2: enter 'sitewire' in the search text field ie.text_field(:name, q).set(sitewire) # q is the name of the search field puts Action: entered sitewire in the search field puts Step 3: click the 'Google Search' button ie.button(:name, btnG).click # btnG is the name of the Search button puts Action: clicked the Google Search button. puts Expected Result: puts - a Google page with results should be shown. 'Programming Ruby' should be high on the list. puts Actual Result: Check that the 'Programming Ruby' link appears on the results page if ie.contains_text(Accelera) puts Test Passed. Found the test string: 'Programming Ruby'. Actual Results match Expected Results. result1 = PASS Test else puts Test Failed! Could not find: 'Programming Ruby' result1 = FAIL TEST end puts puts ## End of test: Google search # -end of simple Google search test #open spreadsheet excel = WIN32OLE.new(excel.application) excel.visible = true # in case you want to see what happens workbook = excel.workbooks.add #Log results excel.worksheet.range(a1).value = Test Results for Sitewire excel.worksheet.range(b1).value = result1 # # Etcetera...assume the above happens 4 times, for 4 screens... # #Format workbook columns #worksheet.range(b1:b4).Interior['ColorIndex'] = 36 #pale yellow excel.worksheet.columns(b:b).AutoFit #close the workbook excel.workbook.saveas('c:\watir\examples\spreadsheet99TEST.xls') excel.workbook.close excel.Quit Stacaz - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5462messageID=15230#15230 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How do I write to simple file instead of screen?
I'm anewbie myself, but I noticed that if I launch my ruby app by double-clicking the icon in windows, the app will execute and close thecmd window. However, if I go to mycmd window first and launch the app from there...then my window stays open and I have a brief history until you close the window. This will work long enough to show your management. For long term solutions you'll want to add some logging functionality...I'd share...but I'm still looking into that myself! ~L Original Message Subject: [Wtr-general] How do I write to simple file instead of screen?From: Scott [EMAIL PROTECTED]Date: Mon, November 27, 2006 5:00 pmTo: wtr-general@rubyforge.orgI am new to Watir, and am trying to build a small demo for management. Can someone give me a quick example on replacing 'puts' with the command that writes instead to a file? My DOS window closes immediately upon completion of running a script and I can't see the results. Also, it there a 'pause' command or something similar?I tried using the example on wikipedia.com for writing to an excel sheet, but it never opened an excel sheet or wrote anything to it.Thanks,Stacaz-Posted via Jive Forumshttp://forums.openqa.org/thread.jspa?threadID=5462messageID=15228#15228___Wtr-general mailing listWtr-general@rubyforge.orghttp://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] A special `method_missing':
Sorry for spam. I just found out the same issue as me, it is a defect of Watir. More details please refer the following thread. http://www.mail-archive.com/wtr-general@rubyforge.org/msg05037.html Thanks. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5436messageID=15232#15232 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general