Re: [Wtr-general] Watir
Welcome Rob! I hope you have have the inclination to keep an eye on what's happening with WATIR, things move fast around here sometimes. Interestingly, we've had a number of discussions of appropriate logging mechanisms for WATIR, but have not gone very far down that path. Any suggestions you have would be welcome in many quarters of the Watir world, I'm sure. -Chris > I can defintely appreciate what you guys have done so far. I have had my own > adventures writing PAMIE over the last years or so. > > I am currently writing a module that will take the output of the testcase > results in XML and convert them to HTML. Similar to JUnit and JMeter ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Javascript menus
> C:\watir\examples>mouse_over.rb > ## Beginning of Example: FortLewis.edu > > Step 1: go to the test site: http://www.fortlewis.edu > c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1979:in > `object_exist_check': Unable to > locate object, using text and Prospective > Students I know Fort Lewis changed their pages since this example was written, but I ran this example just now and the javascript part worked fine. Did you see the yellow floating javascript menus come up, and the elements in those menus get flashed and clicked? That's the part you're interested in. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Javascript menus
> > > Step 1: go to the test site: > > http://www.fortlewis.edu > > > c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1979:in > > > `object_exist_check': Unable to > > > locate object, using text and Prospective > > > Students Odd. It works for me. Are you in fact at the fortlewis.edu site? If you do a view source, does the page contain a widget whose text is " Prospective Students"? Mine does. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] RE: Choosing right attribute?
On 7/8/05, Tuyet Cong-Ton-Nu <[EMAIL PROTECTED]> wrote: > > > > Thank you Shao. Alas, your good suggestion didn't work either. > > irb(main):037:0> > ie.frame("main").frame("header").image(:src, > /icon_export\.gif/).click I think I've encountered this before, and had to specify the full pathname for :src, for instance "C:\web\images\icon_export.gif", or whatever the real source is. Could you address the image by means other than :src? -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] File Download Pop-up
> 1) File Download window asking user to SAVE or OPEN (I want to be able to > click on SAVE here) > 2a) Save window pops up for user to type in file name and SAVE > 2b) Save AS window pops up to ask user whether to REPLACE existing file name > or SAVE AS a new file name (I want to be able to click on REPLACE here) > 3) Save AS small pop-up window to ask for confirmation to Replace YES/NO (I > want to click on YES here) > 4) Download Complete pop-up window to ask user to OPEN, Open Folder, or > CLOSE dialog box (I want to click on Close here) > > If there is something already written for this, I would appreciate you > letting me know where I can find the documentation on this. Thanks! I think that AutoIT (installed with Watir) will do this. I have done this in a Perl script using Perl's Win32::GuiTest module. (BTW, having done "save as", you probably want to check that the file actually exists where you told it to be saved.) I launched the Ruby/Watir script from the Perl script. In the not-too-distant future, there should be a pure-Ruby win32/guitest library available that will handle this sort of thing-- but it's not ready today. (Hint: read up on Ruby Threads.) -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] reg the execution of multiple test cases concuttentlly
Nifty. -Chris On 7/20/05, Atilla Ozgur <[EMAIL PROTECTED]> wrote: > currentFolder = 'D:\\Projects\\Trial\\WatirTests' > Dir.chdir(currentFolder) > paths = Dir.entries(currentFolder) > paths.each{|f| > # I do not want to execute my subversion folder files and my > common functions > if (f =~ /.rb/ && f != 'CommonFunctions.rb') ># for debugging purposes not necessary > puts f > require f > end > } > ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] max number of concurrent threads/ie browser spawned
On 7/20/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > What's the maximum number of concurrent threads that watir can handle? > And what's the maximum number of browser it could launch? I've gotten as many as 60 browsers concurrently running in 10 threads. Closing each browser at the end of each test frees up enough resources to run a much larger number of tests. I think the number of threads Ruby can handle is arbitrarily large, but each thread will compete for resources on the local machine, so it's easy to hit performance bottlenecks with a smallish number of threads, unless you're very careful. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Read data from excel file without open Excel Application?
On 7/21/05, Hue Mach Dieu <[EMAIL PROTECTED]> wrote: > Hi All > I would like read data from excel file without open Excel Application. > This is my code read data from excel must be open Excel Application > Three possibilities: excel['Visible'] = false opens Excel and does work, but never launches the UI. Would that help? Or-- would it be possible to convert your spreadsheets to CSV? That would allow you to process the data as pure text, with no need for Excel. Finally, it is probably possible to open the Excel file directly and parse it using only Ruby, but it would not be easy. Hope that gives you some ideas... ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] RE: Click OK button on Popup Dialog?
On 7/26/05, Scott Hanselman <[EMAIL PROTECTED]> wrote: > Why do folks do all this tricky stuff with Winclicker and starting new > instances of the ruby process? > > I do this: > >Thread.new { sleep 0.1; WindowHelper.new.push_alert_button } >ie.link(:id, "whatever").click #this causes an Alert() I discovered this myself independently: the way to handle popups is in another thread. Those unfamiliar with threads accomplish the same thing by handling popups in another process altogether. (Some silly people have handled popups with an entirely different script running in another scripting *language* altogether...) -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] strange install error
Hi... I'm trying to install Watir on a colleague's machine and getting a strange error. Line 155 of install.rb is bonus_location = homeDrive + "\\watir_bonus\\" # the default bonus location Ruby is giving us an "undefined method "+"" error-- it's interpreting the plus-sign (+) as a method for some reason. This is Ruby 1.8.2. Any suggestions about what might cause this or how to fix it? -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Script return values
Do you know about $!? It holds the last error Ruby encountered. Instead of > rescue > puts("TEST FAILED.") > end try rescue puts ("Test failed. Error: " + $!) end ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] need install tests?
Hi... After reading about the problems with ie.radio() after installing the release version of Watir, I think there may be a problem with the latest versioned Watir installation. A colleague installed Watir this week on a clean XP machine and it was wacky. Files in the wrong place, stuff missing, etc. The main symptom was an error on ie.radio().set. To fix it, I downloaded from CVS head and ran that install.rb, and all was good. I don't think I've ever installed a released Water-- I always grab it from the head of CVS. And I don't really have a machine to do install testing on-- does anyone else? -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Pop up handling improvements
> I'd appreciate comments on this interface, and the names it uses > (remote_eval, dialog). Are you interested in using Wayne Vucenic' Ruby guitest for this? (There should be some big public announcements about a Rubyforge project for this RSN.) -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] I have a couple of questions...
> But, it really would be beneficial to be able to say, I don't know > which frame this is in ... ( I've got situations where the dev team I > support is moving things around a LOT ) ... so, If I can just say, I > know it's called "BLAH" then find it whereever, but I'm sure I can > code that up myself ( I just see it as useful ). I've actually found that having to specify the frame in question turns out to be a blessing, not a curse. It's easy enough to do, and it is one of the features that really sets Watir apart from similar tools. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Small question about split String?
> My string in some case as like this: > Case1: A13 -> The result must be in array: [A, 13] > Case2: ACB12334 -> The result must be in array: [ABC, 12334] Here's one way: string = "ACB12334" string =~ /[A-Z]/ alphas = $& string = "ACB12334" string =~ /[0-9]/ numerics = $& ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Re: Small question about split String?
On 8/7/05, Hue Mach Dieu <[EMAIL PROTECTED]> wrote: > Hi > I follow your ways, but it seem don't work Oops. irb(main):012:0> string = "ACB12334" => "ACB12334" irb(main):013:0> string =~ /([A-Z])*/ => 0 irb(main):014:0> puts $& ACB Forgot the "*". See pp 68-77 of Programming Ruby. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Object repository, Popups and other enhancements
Therefore, we decided to release this enhancement as > an opensource work. The framework is available for download at > > http://www.wet.qantom.org > > WET, as it is called, is a great compliment to Watir. This looks really neat, I'm looking forward to using it! -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Load Testing with Watir?
On 8/22/05, saud aziz <[EMAIL PROTECTED]> wrote: > True, but i could set up scripts to run on different computers, say at most > 15-20 scenarios for each machine on a total of 30 machines and get > performance metrics out of web server. Do you think that is even a good > start? > The other problem is that if you do encounter a performance problem, there are no hooks into Windows for diagnosis in Watir, and probably not in Ruby either. Check out Grinder or OpenSTA for full-fledged open-source performance test frameworks. On the other hand, Watir/Ruby will give you simple lightweight performance information, as long as you don't expect too much. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
begin/assert/rescue harrmful? Re: [Wtr-general] assert PASSED and FAILED
> 3. "begin/assert/rescue" is really a bad idea and we will stop suggesting it. I *like* begin/assert/rescue. It's my friend. Why is it a bad idea? -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Rubyforge stats: Watir #1
Hey... I just noticed that Watir is the most active project on rubyforge right now. And it's creeping up the list of top project downloads, too. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Unicode and Watir
On 8/31/05, Bret Pettichord <[EMAIL PROTECTED]> wrote: > I have a client who would like to use Watir to test a Unicode enabled > application, supporting double-byte languages such as Chinese and Japanese. > It looks to me like it doesn't work, but i haven't done Unicode with Ruby > before and thought i would check to see if any one else had looked into this. I ran across http://www.tbray.org/ongoing/When/200x/2005/08/27/Ruby as a link from whytheluckystiff's blog in which Tim Bray said of Ruby "The support for Unicode in regular expressions seems quite a bit behind what you have now in Perl and Java" C "hearsay" M ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Anyone integrate ActiveRecord with Watir?
Anyone built an object-relational database interface into a Ruby test system? Care to share any code? -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] About the installation of DBI
Google "nmake". -Chris On 9/6/05, jim che <[EMAIL PROTECTED]> wrote: > Hi Dave > I found that if I want to use the DBI I first should install the Ruby > MySQL Module then install the Ruby DBI Module .But in fact I found these two > tools should be installed under the Linux like system. > > Installation of Ruby MySQL Module : > ruby extconf.rb >% make >% make install > > Installation of Ruby DBI Module >ruby setup.rb config >% ruby setup.rb setup >% ruby setup.rb install > > As above shows the Installation of Ruby DBI Module can be executed in win32 > but the Ruby MySQL Module cann't installed under windows system the system > cann't recognize the 'make' command. > > So what should I do if I want to use the Ruby DBI under the windows system > > Thank you very much. > > > > jim > > > > > > > > > > Click here to donate to the Hurricane Katrina relief effort. > > > ___ > 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] Unicode and Watir
> I can see the Japanese text in the browser and can copy it into Excel or > WordPad. > > So i figure i have the fonts i need. But when i use Ruby WIN32OLE to get > the text from Excel or IE, i only get "". Make sure that you can actually *save* the Excel doc with the Japanese text. Save and re-open-- I've got $0.25 that says you get "" when you re-open your Excel doc. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Unicode and Watir
I owe you a quarter! -Chris On 9/8/05, Bret Pettichord <[EMAIL PROTECTED]> wrote: > At 08:43 AM 9/8/2005, Chris McMahon wrote: > >Make sure that you can actually *save* the Excel doc with the Japanese > >text. Save and re-open-- I've got $0.25 that says you get "" when > >you re-open your Excel doc. > > You owe me a quarter. > > Check cell B1. I can see Japanese when i open the doc. Can you? > > (If you see boxes, that means that the text is intact, you just don't have > the fonts to display them.) ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] getting popup menu handle (from perlguitest list)
FYI... -- Forwarded message -- From: [EMAIL PROTECTED] <[EMAIL PROTECTED]> Date: 9 Sep 2005 17:39:31 - Subject: [perlguitest] Digest Number 387 To: [EMAIL PROTECTED] Yahoo! Groups Sponsor ~--> Most low income households are not online. Help bridge the digital divide today! http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/ndFolB/TM ~-> There are 2 messages in this issue. Topics in this digest: 1. Getting the Popup menu handle. It may work but it's hedious From: "rafelafrance" <[EMAIL PROTECTED]> 2. Re: Getting the Popup menu handle. It may work but it's hedious From: "Piotr Kaluski" <[EMAIL PROTECTED]> Message: 1 Date: Thu, 08 Sep 2005 23:40:46 - From: "rafelafrance" <[EMAIL PROTECTED]> Subject: Getting the Popup menu handle. It may work but it's hedious *Ugh* The current method (I'll space you the XS code): THERE HAS TO BE A BETTER WAY! 1) Call up the context menu using MouseClick() or SendKeys() 2) Set up an event trap to look for the WM_MENUSELECT event 3) SendKeys('{DOWN}'); #Which will post the WM_MENUSELECT 4) In the callback HookProc() get the popup handle from lParam. 5) Call another routine to retrive the popup handle GetPopupHandle() This should sound like nails on a chalkboard by about now. The problems are legion and here are just a few. - If you never call GetPopupHandle() the hook isn't released. BAD! Sure I test & release it if I can but there's no guarantee. - You have to dirty the menu by pressing {DOWN} to get its handle == I've tried to get the popup handle all in one fell swoop by doing the SendKeys() etc in the C code but that wasn't working. Tho it seems like the way to go. Maybe... I'm looking for other events to trap that don't dirty the menu but I haven't found any that would be generally useful. Any suggestions? Maybe I can set up an XS object so that the trap will be set up once during New(). Have all popups post to this object and release the hook during the DESTROY method. A lot of work for little reward. = Any ideas please. Message: 2 Date: Fri, 09 Sep 2005 06:46:02 - From: "Piotr Kaluski" <[EMAIL PROTECTED]> Subject: Re: Getting the Popup menu handle. It may work but it's hedious Hi, Some time ago I was trying to find a solution for the same problem. I was thinking on the way to handle IE menu bar and its submenus. This problem is related to what you write about, since IE menu is a toolbar with popup menus. And yes, you are right about the main problem - how to get a menu handle. Win32 API provides many fancy functions for managing menus but most of them expect menu handle as a parameter. I have found one promising function - GetMenuBarInfo. However I could not make the function work. I was getting really strange error messages (including "Function was successful", with an indication that there is an error). I tried to post the question to win32 programming newsgroup, but did not get any help. It would be good to have some real windows guru to have a look at it. -Piotr --- In [EMAIL PROTECTED], "rafelafrance" <[EMAIL PROTECTED]> wrote: > *Ugh* The current method (I'll space you the XS code): THERE HAS TO > BE A BETTER WAY! > > 1) Call up the context menu using MouseClick() or SendKeys() > 2) Set up an event trap to look for the WM_MENUSELECT event > 3) SendKeys('{DOWN}'); #Which will post the WM_MENUSELECT > 4) In the callback HookProc() get the popup handle from lParam. > 5) Call another routine to retrive the popup handle GetPopupHandle() > > This should sound like nails on a chalkboard by about now. The > problems are legion and here are just a few. > > - If you never call GetPopupHandle() the hook isn't released. BAD! > Sure I test & release it if I can but there's no guarantee. > - You have to dirty the menu by pressing {DOWN} to get its handle > > == > I've tried to get the popup handle all in one fell swoop by doing the > SendKeys() etc in the C code but that wasn't working. Tho it seems > like the way to go. Maybe... > > I'm looking for other events to trap that don't dirty the menu but I > haven't found any that would be generally useful. Any suggestions? > > Maybe I can set up an XS object so that the trap will be set up once > during New(). Have all popups post to this object and release the > hook during the DESTROY method. A lot of work for little reward. > = > > Any ideas please.
Re: [Wtr-general] Database Connectivity
On 9/16/05, Bret Pettichord <[EMAIL PROTECTED]> wrote: > There has been a lot of discussion regarding how to use Ruby to connect to > a database. It would be great if someone collected this information and > published it. I've been doing lots of ODBC recently, and reading http://www.ch-werner.de/rubyodbc/odbc.html It's pretty handy. A nifty aspect of Ruby's ODBC (true of all of Ruby DBI?) is that the fetch methods consistently return arrays of arrays (AoA). That is SELECT a, b, c FROM table yields [[a1,b1,c1],[a2,b2,c2],etc]. Which I find really easy to use. I suspect that the reason that more Ruby DBI docs don't exist is that DBI is pretty old and extremely well-documented in other languages, particularly Perl. http://search.cpan.org/~timb/DBI-1.48/DBI.pm. There are whole books about Perl's DBI, and a DBI libraries all work in roughly the same way. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Trapping page source on error
> from scripts that have errors. Our developers pointed out that > providing the HTML source of the page loaded in IE at the time of the > error would be great. begin assert(ie.foo == x) rescue => e puts ie.getHTML end would do it, yes? -C ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Help regarding assert commands in watir.
> Can anyone send me some information abt how various > Assert commands are used in watir?. Also see "Programming Ruby" (the Pickaxe book) 2ed. pp 151-162. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] About the installation of DBI
OT, disregard if you don't care about ODBC or Perl... > I think Ruby's DBI (at least for Win32) is not as mature as Perl's by a > long shot. I really miss that, because I make *extensive* use of the Perl > DBI. I've been doing heavy ODBC work with Ruby's DBI (on Win32) for the last few weeks, and it looks good from here-- that is, I haven't yet found anything I can't do with the Ruby DBI. In some ways, Ruby's DBI is easier to use (for me) than Perl's. Mostly because returns from SQL statements seem to always be either arrays or AoAs, which I find really intuitive to use, where in Perl's DBI, returns are generally hashes, and you have to be pretty familiar with the DBI docs to figure out how to address the data. I realize that Perl's DBI is a lot older and has a lot more bells and whistles, but (so far) I haven't needed those features, and Ruby DBI seems to be easier to use. And that's not even talking about ActiveRecord, which I have yet to fool with. That said, the instant I need a feature available with Perl's DBI not available with Ruby's DBI, I'm switching to Perl. =) -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] About the installation of DBI
> Still OT > Chris, what is AoAs ? As Dave Burt noted, AoA is "array of arrays", like [[A,B,C,],[1,2,3],[X,Y,Z]] for instance. Ruby's array handling is nifty. > At my current site, I use WATiR, but cannot do any DB work in Ruby, > because the DB (DB2 on zOS) doesn't allow ODBC connections. I'm using DB2 on AS/400 (!!!) at the moment. IBM supplies a nice DB2 ODBC interface for Windows through their "iSeries Navigator" suite of tools, and Ruby's ODBC drivers plays very nicely with it. You need to > access certain sys/admin tables to get an ODBC connection, and we don't > have even select rights on those. I cannot get the Ruby DB2 driver to > work on my 'doze box. So, Perl + DBD::DB2. I can't help with your permissions. =) BTW, I guess it's not a big secret, but: I *like* Perl. I'm working in a culture that's excited about Ruby. And right now I have no need for Watir. So I could actually do my current work in either Ruby or Perl, and it's just more funner right now in Ruby. It's also nice to have Plan B: the moment I run into something Ruby can't do, I'll happily switch to Perl. Nice to have alternatives... Look through the archives and you'll see mention of my handling Javascript popups with a Perl Win32::GuiTest layer. I still think that's a valid approach, with all due respect to the Wet and AutoIT fans. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] About the installation of DBI
Hi Dave... > > Look through the archives and you'll see mention of my handling > > Javascript popups with a Perl Win32::GuiTest layer. I still think > > that's a valid approach, with all due respect to the Wet and AutoIT > > fans. > > Interesting. I've hardly touched Perl since I started with Ruby. I used to > like > Perl; I wonder If I can still handle it (Ruby seems to click easier with more > complex data structures than simple arrays and hashes.) I'm going to have to > dig up your Win32::GuiTest posts and have a play, I think, Chris. Here ya go! Just BTW, the following code is in an article in next month's Better Software magazine: use Win32::GuiTest qw(FindWindowLike GetWindowText SetForegroundWindow SendKeys); system (1, "C:\\ruby\\bin\\ruby.exe C:\\watir\\examples\\Demo.rb"); while (1) { #INFINITE LOOP sleep 5; #CHECK FOR NEW WINDOW EVERY 5 SEC my @windows = FindWindowLike(0, "^Microsoft Internet Explorer" ); for (@windows) { SetForegroundWindow($_); #BRING THE RIGHT WINDOW IN FOCUS SendKeys("{ENTER}"); } } ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] OT: double-quotes and substitution in same string?
Hi... Sorry for the OT post, but this is driving me crazy... I have an XML string that needs double-quotes, so to turn it into a string, I enclose in single quotes. It looks a little like this: '' But I also need to substitute a variable into the string with #{}, like so: a = 123 '' but #{} doesn't work inside of single-quoted strings, and double-quotes inside of double-quotes are illegal, and slashes also don't work, i.e a = 123 // Any suggestions to substitute a string and use double-quotes simultaneously in a single string? I'm sure it's possible, I just can't figure out how -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Got it. (thanks Mark) Re: OT: double-quotes and substitution in same string?
On 9/28/05, Cain, Mark <[EMAIL PROTECTED]> wrote: > What about this it worked for me: > > '' > Almost. Trouble is that the whole thing had to be assigned to a variable. What worked was escaping the double-quotes, like str = "http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] OT: double-quotes and substitution in same string?
On 9/28/05, Bret Pettichord <[EMAIL PROTECTED]> wrote: > %Q is ticket for this kind of thing: > >%Q[] Oooh. This is cool. =) > Another option is to backquote the interior double-quotes: > >"" This is what I eventually discovered. > Any questions about testing with Ruby are on-topic for this list. I think so too. Do we have etiquette in place for msgs. not having to do with Watir directly? I've been using "OT", but maybe that's not the best. I'd go to ruby-talk, but the volume there is just too high. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] OT again: REXML to extract only values from XML?
Again, apologies for non-Watir content, but some REXML: say I have an XML record like CHRIS MCMAHON 11122 I'd like to extract each value of each tag (without regard to hierarchy) and add it to an array: ["CHRIS","MCMAHON","11122"] The REXML docs don't seem to address this. I've tried various methods, but I can't seem to find the way to address only the contents of each tag. Any suggestions would be welcome OBLIGATORY WATIR CONTENT: the Watir distro has a REXML logging scheme with lots of nice comments. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How do I save a web page from a test run (attempt using Win32API)?
> Canoo WebTest has a nice feature whereby the HTML pages of the application > under test are saved for viewing later, which is very handy when a test case > fails. Why not if "#{test_passed}" puts "Yay!" else puts ie.getHTML end ? -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] OT: generate random text?
Hi... I want to generate some random text for test purposes. "rand" doesn't seem to DWIM. Say, to pick an arbitrary letter from the uppercase range A to Z. [A-Z].rand [A..Z].rand seems right, but isn't. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] OT: generate random text?
> then, where ever you need it : just call it > > random_text( 42 ) # for 42 chars of random text ... Neato! Thanks! -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Wacky WikiWords Re: Website Update
> - Added testimonials. Testimonials page is full of WikiWords (WaTIR, QuickTest, RubyWebDialogs, etc.) That read as if they are questions. Suggest you either build link pages for the WikiWords or else escape them. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Wacky WikiWords Re: Website Update
> I agree they look odd. How do you escape them? Depends on your wiki implementation. Somewhere you have to have a local guide to markup syntax that should tell how to do that. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] OT: Ruby2 and Perl6
Hi... If you're not already reading whytheluckystiff's blog at redhanded.hobix.com, you should be. (You've all read "Why's Poignant Guide to Ruby" already, right? Chunky bacon!) Today's entry features multiple superstars revolving around each other in the comments: http://redhanded.hobix.com/inspect/pugsAndEigenclassesYessirThisSatireSGotLegs.html#comments Imagine a FrankenLanguage that is Ruby2 and Perl6 implemented in Haskell. Makes my brain take flight toward chilled shrimp. -C "Mr. OT" M ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] OT (test/unit): how to grab output from assert_foo(x, y)?
Hi... When you use any of the test/unit methods, like "assert_equal", you always get a nice output message like 1 tests, 2 assertions, 0 failures, 0 errors or <"CLARICE"> expected but was <"JOHN">. 1 tests, 1 assertions, 1 failures, 0 errors How can I manipulate that output message? It's not in $_ or $!, and I can't seem to assign it to a variable. None of these work; the puts' are always "nil": a = assert_equal(x,y) puts a assert_equal(x,y) puts $_ assert_equal(x,y) puts $! Any suggestions welcome... -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] OT (test/unit): how to grab output from assert_foo(x, y)?
> If you want to change the error message that appears when a test fail, use >assert(equal(x, y), "dude, they don't match!") Yah, I knew this. What I really want to do is grab STDOUT (or whatever) generated from assert_equal, stick it in a variable, and use Watir to write the contents of that variable to a "test results" page on the WEA wiki. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Handling PopUps revisited
On 10/8/05, saud aziz <[EMAIL PROTECTED]> wrote: > Chris McMahon gave away a great tip on how to run ruby script from perl in > this months' Better Software magazine and that does appeal to me as a great > solution. Thanks for the kind words. I think Perl's Win32:GuiTest (http://sourceforge.net/projects/winguitest/) is worth examining. It's a lively project, with some interesting recent innovation. Wayne Vucenic got a good start on translating it to Ruby: (http://rubyforge.org/projects/guitest/). However it's done, it demands one thread/layer to deal with IE, and another thread/layer to deal with the popups. Watir can't be beat for mucking around with IE-- but in my mind, the jury is still out as to the best way to deal with popups. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Desperately seeking Popup assistance
On 10/11/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Apparently I am just not getting it. I have tried for several days now to > get WATIR to handle a modal without success. I also have a Popup utility > that I cannot get WATIR to recognize. > > Any tips, code snippets, questions, divine guidance, and lecturing would be > most appreciated. Unfortunately I can not share the application specific > HTML nor provide access to this application, so not much help there. Hi Carl... I really, really feel your pain, and I am just not in a position right now to take a crack at your question. I can't give you divine guidance (and I don't live in Austin) but here's a clue: threads. And fork() One way or another, you have to handle popups in a different process than the one that is controlling your IE. If you don't have an answer by next week, I'll be back, but in the meantime, think about forking and threads, and maybe ask one more time. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Nice mention of Watir from Harry Robinson of Google.
Harry Robinson, late of Microsoft, currently with Google, was on a panel at the Pacific Northwest Software Quality Conference (pnsqc.org). The panelists were asked about new tools in their toolbox. Robinson said that the best new tool he'd seen in years was Watir. I introduced myself after the panel, and found that Google is using Watir to test Google Maps. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] painfully stupid AutoIT question
This should work, right? # popup_thread = Thread.new { puts "entering popup thread" sleep 1 @autoit = WIN32OLE.new('AutoItX3.Control') @autoit.WinWait "", "" @autoit.Send "{ENTER}" puts Time.now } puts "clicking link" puts Time.now @ie.link(:id,"peskyPopupLink").click popup_thread.join #JUST IN CASE ### popup_thread starts, returning control to the calling script Watir clicks peskyPopupLink popup_thread sleeps 1 second, cranks up AutoIt, attaches to top window, and hits the default button. But I don't think popup_thread ever completes. Output from this script is Started entering popup thread clicking link Thu Oct 20 11:53:51 Central Daylight Time 2005 leading me to believe that the "puts Time.now" in popup_thread is never executed. Any suggestions as to what I've done wrong are welcome... -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] screw it, I'm using Perl Fwd: painfully stupid AutoIT question
Hi... I definitely have some sort of WIN32OLE vs AutoIt problem. I broke out the Perl controller to capture that particular error message. I gave up on AutoIt, I'm using Perl Win32::GuiTest and perl system(1,ruby.exe) for a controller. It's easy, it's bulletproof, and it works. -Chris -- Forwarded message ------ From: Chris McMahon <[EMAIL PROTECTED]> Date: Oct 20, 2005 11:58 AM Subject: painfully stupid AutoIT question To: wtr-general@rubyforge.org This should work, right? # popup_thread = Thread.new { puts "entering popup thread" sleep 1 @autoit = WIN32OLE.new('AutoItX3.Control') @autoit.WinWait "", "" @autoit.Send "{ENTER}" puts Time.now } puts "clicking link" puts Time.now @ie.link(:id,"peskyPopupLink").click popup_thread.join #JUST IN CASE ### popup_thread starts, returning control to the calling script Watir clicks peskyPopupLink popup_thread sleeps 1 second, cranks up AutoIt, attaches to top window, and hits the default button. But I don't think popup_thread ever completes. Output from this script is Started entering popup thread clicking link Thu Oct 20 11:53:51 Central Daylight Time 2005 leading me to believe that the "puts Time.now" in popup_thread is never executed. Any suggestions as to what I've done wrong are welcome... -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] screw it, I'm using Perl Fwd: painfully stupid AutoIT question
Actually, I had a inscrutable error message from the WIN32OLE/AutoIT axis that I couldn't figure out. I was only able to capture the msg. when running the AutoIt script in the Perl controller. -C On 10/20/05, Jeff Wood <[EMAIL PROTECTED]> wrote: > Actually, the problem is that you didn't tell AutoIT WHICH window to > send the RETURN to ... > > If you look at the documentation and the unit tests that are included > with Watir, you will see proper usage for AutoIT. > > j. > > On 10/20/05, Chris McMahon <[EMAIL PROTECTED]> wrote: > > Hi... > > I definitely have some sort of WIN32OLE vs AutoIt problem. I > > broke out the Perl controller to capture that particular error > > message. > > I gave up on AutoIt, I'm using Perl Win32::GuiTest and perl > > system(1,ruby.exe) for a controller. It's easy, it's bulletproof, and > > it works. > > > > -Chris > > > > -- Forwarded message -- > > From: Chris McMahon <[EMAIL PROTECTED]> > > Date: Oct 20, 2005 11:58 AM > > Subject: painfully stupid AutoIT question > > To: wtr-general@rubyforge.org > > > > > > This should work, right? > > > > # > > popup_thread = Thread.new { > > puts "entering popup thread" > > sleep 1 > > @autoit = WIN32OLE.new('AutoItX3.Control') > > @autoit.WinWait "", "" > > @autoit.Send "{ENTER}" > >puts Time.now > > } > > > > puts "clicking link" > > puts Time.now > > @ie.link(:id,"peskyPopupLink").click > > > > popup_thread.join #JUST IN CASE > > ### > > > > popup_thread starts, returning control to the calling script > > Watir clicks peskyPopupLink > > popup_thread sleeps 1 second, cranks up AutoIt, attaches to top > > window, and hits the default button. > > > > But I don't think popup_thread ever completes. Output from this script is > > > > Started > > entering popup thread > > clicking link > > Thu Oct 20 11:53:51 Central Daylight Time 2005 > > > > leading me to believe that the "puts Time.now" in popup_thread is > > never executed. Any suggestions as to what I've done wrong are > > welcome... > > -Chris > > > > ___ > > Wtr-general mailing list > > Wtr-general@rubyforge.org > > http://rubyforge.org/mailman/listinfo/wtr-general > > > > > -- > "http://ruby-lang.org -- do you ruby?" > > Jeff Wood > > ___ > 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] screw it, I'm using Perl Fwd: painfully stupid AutoIT question
> The threading in the Win32 Ruby implementation is distinctly inferior to > Perl's. There, i said it. Yikes! Perl's threads are no great shakes, and neither are Windows'. I was under the impression that Ruby's threads were about the best out there. -C ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] screw it, I'm using Perl Fwd: painfully stupid AutoIT question
> yes/no? I really, really like the architecture of a process that loops, handling normal Windows client windows with a GuiTest implementation, and another process that uses Watir to muck around in IE. Once it's running, maintenance is trivial, adding handling for new popup windows is easy, and there are none of the tightly-coupled issues when trying to manipulate multiple threads from within the same script. That said, I wonder how Wayne is doing on a Ruby GuiTest? Anyone know? (I've been following the Perl GuiTest mail list, and version 1.5x looks really, really powerful.) -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] screw it, I'm using Perl Fwd: painfully stupid AutoIT question
On 10/21/05, Jeff Wood <[EMAIL PROTECTED]> wrote: > All I can say is ... well, there should be nothing perl can do that > ruby can't do better ( except make really line-noise looking scripts > ;) ) Win32::GuitTest Wayne Vucenic has gotten a good start at porting an earlier version of this Perl module to Ruby, but got stalled. Activestate Perl has Win32::GuiTest v 1.3 in the default install, but current development is on 1.5, and took several leaps forward over the last few months. It's a powerful library, worth looking into if you have to manipulate normal Windows GUIs. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] ruby threads
On 10/21/05, Bret Pettichord <[EMAIL PROTECTED]> wrote: > By rights, when you spawn a separate thread, if it blocks that shouldn't > affect other threads. That that is not how it works with the Win32 Ruby. > (The unix ruby, including the cygwin ruby work correctly.) Ah. Good explanation, that explains the behavior I saw. I am surprised several times every month that we are all still using Windows. -C ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Conference Inet-tr
On 10/22/05, Atilla Ozgur <[EMAIL PROTECTED]> wrote: > I have sent two articles about watir to inet-tr conference. Which is > one of the most prestigious Internet Conferences of Turkey. Both were > accepted. Congratulations! > Second one shows how you can use watir for Sql Injection attacks. > But i will translate sql injection one to english, when I > find some time. I would very much like to read this one. Please consider publishing the SQL injection piece, I think it would be fascinating. I would be willing to bet that someone would publish it-- Better Software, or Software Development Magazine, or Dr. Dobbs, or InformIT-- it'd be good reading any of those places, I think. (And if you'd like someone to read a draft, please sign me up!) Again, well done! -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] getting the exception value
> Also I wonder is there a Ruby HTTP client library? Something like Perl's > LWP? That way, when get an exception, I would do an HTTP request > using the last URL. net/http works nicely for me. Probably not as high-powered as LWP, but gets the job done. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] password clear text
> ie.text_field(:name,"passwd").setEncrypted(password.encrypted.file) > > I did not find anything in the archive about this, but perhaps I missed. rot13 in Ruby: $_.tr! "A-Za-z", "N-ZA-Mn-za-m" Seriously, though, googling for "ruby encrypt" turns up http://aescrypt.sourceforge.net/ as the very first hit. Watir is really only concerned with manipulating Internet Explorer. Any features not directly related to manipulating IE generally have to come from the greater world of Ruby. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] password clear text
> Your suggested use of encryption sounds like waving a magic wand without > really protecting anything. I am sure that there is a way to do what you > ask, but i just don't see the point. Like I said, rot13! =) -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Is there a method to do ie.contains_html() ?
assert_match("mystring",ie.html) I use this all the time. On 10/26/05, Sy Ali <[EMAIL PROTECTED]> wrote: > I know about contains_text() but is there some sort of contains_html() > feature, or should I build my own method to do this? > > I notice html() which will output the entirety of the HTML for a page, > but is there an easy way to match text within that. > > I mean to ask.. has anyone written a snippet of code which I can re-use? > > ___ > 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] Intermittent bug setting radio buttons with high index values
I have an HTML page with a large number of radio buttons that I address by index. Sometimes my script succeeds, but more often I'm getting error messages Watir::Exception::UnknownObjectException: Unable to locate object, using index and 17 (or 16, or 20, or 19) Has anyone else seen this behavior? -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Probably a timing problem : Intermittent bug setting radio buttons with high index values
If I split my radio-setting commands into two smaller groups and perform other actions in between, all of the radio-setting works. -Chris -- Forwarded message -- From: Chris McMahon <[EMAIL PROTECTED]> Date: Oct 26, 2005 4:57 PM Subject: Intermittent bug setting radio buttons with high index values To: wtr-general@rubyforge.org I have an HTML page with a large number of radio buttons that I address by index. Sometimes my script succeeds, but more often I'm getting error messages Watir::Exception::UnknownObjectException: Unable to locate object, using index and 17 (or 16, or 20, or 19) Has anyone else seen this behavior? -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] My regexp is too greedy!!
> The following ruby expression > / (.*local.xml?)/.match('xpl.xml, demoUK.xml, met_local.xml, cfg.xml')[1] > returns > => "demoUK.xml, met_local.xml" I'll take a crack-- how about #3 string = 'xpl.xml, demoUK.xml, met_local.xml, cfg.xml' files = string.split(', ') #comma space files.each {|x| puts x if x=~ /local.xml/ } # Does that help? -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] dynamically discover page
># Parse the web page, extracting links to images >def parse(host) >dict = { } >@body= host.getHTML() This is pretty funky. Parsing HTML is non-trivial. Perhaps a different approach? It doesn't do it today, but I'll bet the ie.show_all_objects method could be hacked to create a manipulable structure of all of the page elements. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Is there a method to do ie.contains_html() ?
> I hear Arachno Ruby has a good debugger. Scite is good for the first week > of Ruby programming; then you need something better. I've used emacs and > now use Eclipse. I don't actually use a debugger for Ruby. Instead i use > IRB and puts. And lots of unit tests. How ''bout a pre-configured Eclipse in the Watir distro? (As Alexey says, "ha ha, only serious". Scite is still what I'm using, mostly because I haven't had the willpower to tackle the Eclipse learning curve. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] iexplore process remains after closing IE?
I seem to remember a conversation about this, but I couldn't find it in a cursory search of the mail archive: Every time I click on the IE close box, the IE windows disappears, but I still have an "iexplore.exe" process running. I need to manually end this process in Windows Task Manager in order for subsequent Watir tests to run properly. Is there an automated way to really, really kill this iexplore process? -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] iexplore process remains after closing IE?
On 10/31/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > You can use a tool like pskill for windows, but you'll need to know the PID. > > -Jonathan Any idea what causes this? I'm pretty sure an explicit ie.close won't kill this beast. -C ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Preceding text of textfield
On 11/1/05, boonhoo <[EMAIL PROTECTED]> wrote: > Hi, is it possible to obtain the preceding text of a textfield in > Watir? For e.g. consider this html - > > username : > > I would like to obtain the string 'username' that appear before the > textfield. Thanks! Here's a Perlish sort of approach: 33 string = "username : " string =~ /:/ before = $` match = $& after = $' puts before puts after # Hope that helps. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Architecting WATIR for a WEB application
> What are some considerations that will help the planning and layout of WATIR > architecture if you are to start from scratch to automate a WEB site? I > would appreciate hearing from experienced WATIR users on what approaches you > have chosen to structure/architect the way you use WATIR for your WEB > application. Thanks. I suspect that the sophisticated Watir users on this list would tell you that the answer to your question depends on individual context. That is, every project is different. As a general principle, though, a lot of people suggest that your framework should be abstracted from your implementation. In other words: start solving problems; refactor; repeat; don't worry about architecture so much as you worry about solving the immediate problem-- your architecture will grow as your ability to solve problems does. As always, I'll cite Kevin Lawrence's March 2005 Better Software article called "Grow Your Test Harness Naturally" which seems to be the most important reference out there for doing this sort of work. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] whytheluckystiff on Selenium and Watir
http://redhanded.hobix.com/inspect/theSoundsOfSeleniumTestingYourWeblickation.html The comment from user "<|:{" is really funny. BTW, if you're not surfing redhanded.hobix.com, and "why's Poignant Guide To Ruby", you should do so. Immediately. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] iexplore process remains after closing IE?
> Is there a way to report the pid of IE.new ? This question just got asked on the perlguitest mail list today, too. I'll keep my eyes open there for an answer, too. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to hide the explorer window in Watir
On 11/6/05, chaya shetty <[EMAIL PROTECTED]> wrote: > Hi, > I tried with both $ie.minimize and with -b option, but still the popups were > not hidden. Is there any other way?? Selenium does this, I think-- but it intercepts the Javascript before the popup fires, if I'm not mistaken. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] iexplore process remains after closing IE?
Paul, I'm not following your example below. It's clearly valid code, I run it and pid.unpack("L")[0] is "538976288", but I don't get how the pid is related to a Watir "IE.new". Sorry if it's a silly question, but I'm not getting it... -Chris On 11/5/05, Paul Rogers <[EMAIL PROTECTED]> wrote: > Try this > > require 'Win32API' > > hWnd = 985158# use the hWnd for your process > # pid is a dword > pid=" " * 32 > thread= Win32API.new("user32", "GetWindowThreadProcessId", 'IP', > 'I').Call(hWnd,pid) > puts pid.unpack("L")[0] > > I think you can do ie.hWnd to get the hWnd on the second line > > Paul > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Sy Ali > Sent: 04 November 2005 15:04 > To: wtr-general@rubyforge.org > Subject: Re: [Wtr-general] iexplore process remains after closing IE? > > > On 10/31/05, Jeff Wood <[EMAIL PROTECTED]> wrote: > > require 'watir' > > include Watir > > > > ie = IE.new > > ie.goto "www.google.com" > > ie.close > > Is there a way to report the pid of IE.new ? > > ___ > 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 mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Last but not least Re: iexplore process remains after closing IE?
OK, I got it now-- What's the syntax to actually close the browser using the pid/wHnd? -Chris On 11/7/05, Paul Rogers <[EMAIL PROTECTED]> wrote: > you'll need to get the hWnd of the browser first > > require 'Win32API' > > > ie = IE.new > ie.goto "www.google.com" > > hWnd = ie.ie.hWnd > pid=" " * 32 > thread= Win32API.new("user32", "GetWindowThreadProcessId", 'IP', > 'I').Call(hWnd,pid) > puts pid.unpack("L")[0] > > ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Last but not least Re: iexplore process remains after closing IE?
On 11/7/05, Paul Rogers <[EMAIL PROTECTED]> wrote: > I think its > > Process.kill( 9 , pid) This rawks, thanks! Works great. (Note-- have to use the unpacked pid to kill the process, but it works like a charm.) -Chris PS Whoda thunk Ruby would let you do a "kill -9" on Windows? I'm amused... ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Code to really really really kill IE
Thanks Paul, I put it together in an easy example. This is tested and works: require 'win32ole' require 'watir' # the controller include Watir require 'Win32API' @ie = IE.new hWnd = @ie.ie.hWnd pid=" " * 32 thread= Win32API.new("user32", "GetWindowThreadProcessId", 'IP', 'I').Call(hWnd,pid) fixnum_pid = pid.unpack("L")[0] puts fixnum_pid Process.kill( 9 , fixnum_pid) ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Watir bug?
This is strange, I don't think there should have been a security error-- anyone know what's going on here? irb(main):007:0> @ie.goto("http://msdn.microsoft.com/msdnmag/issues/05/11/CodeAc cessSecurity/default.aspx#void") W, [10-Nov-2005 09:18:55#3184] WARN -- : frame error in waitdocument OLE error code:80070005 in Access is denied. HRESULT error code:0x80020009 Exception occurred. c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1340:in `method_missing' c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1340:in `wait' c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1339:in `upto' c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1339:in `wait' c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1179:in `goto' (irb):7:in `irb_binding' c:/ruby/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding' :0 => 0.02 irb(main):008:0> -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Watir bug?
On 11/10/05, Bret Pettichord <[EMAIL PROTECTED]> wrote: > The page contains a frame that is posted on a separate server. > http://ads.ddj.com/msdnmag/premium.htm DARN those Microsoft people !!! =) -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Accessing frames or anchors
> I viewed source of the "main" section and found this tag: name="mainContent">. Is this how I access that area? What happens when you try? =) In the case of nested frames, I remember finding that using irb and ie.show_frames was generally more helpful than using "view source". With irb, you always know which frame is inside which other frame. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Wtr-general Digest, Vol 24, Issue 29
On 11/22/05, Torres, Ben (HQP) <[EMAIL PROTECTED]> wrote: > Thanks Jeff! This mailing list rocks! > > I was able to grab the url, but now '&' shows up in the url. How do > I remove 'amp;' and just leave '&' in the string? The right way is to use an HTML parser. The quick'n'dirty way is string.gsub("&",""&") I know, I just used the quick'n'dirty way (for now)... =) -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Stress testing using watir/ruby?
> I'm wondering what is the best way to create thousands (more than 25K) of > these processes and have them all storm the server at once. Check the mail list archives-- a reasonably powerful client will support around 50-70 browsers at the same time. You'd need about 5000 different computers running your script. Check out tools like grinder, httpunit, OpenSTA, WWW::Mechanize and friends, Canoo, etc. These tools are all useragents with measurement features, rather than browser-drivers. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] OT: silly format question: get Ruby to ignore line ends for long lines?
Hi all... Is there a way to get Ruby to ignore line ends in a long text string for readabiliy purposes, for instance a long SQL query? " select * from LIB.ACCOUNTs accounts, LIB.SSNS ssns, LIB.PLANS plans where accounts.FOO_KEY = ssns.BAR_KEY and plan.BAZ_KEY = ssns.BAR_KEY and ssns.DEPCD = '' and ... ETC ETC ETC " Thanks for your patience... -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] OT: silly format question: get Ruby to ignore l ine ends for long lines?
> Or, are you trying to put a sql statement in source code with extra \n's so > that it is more readable to you ??? That'd be the one. I think you guys got me where I need to be, thanks! -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Check database
> I am having a hard time finding how to setup some database libraries > to make some assertions on my code after driving the UI. Since I am > primarly looking for general DB access, I have tried ruby-dbi with > little success by now. Maybe I will try ruby-mysql, but I really want > something not tied to one database. A quick Google shows that MySQL has an ODBC interface. I've been having good success with the odbc library included in the current Ruby Windows installation: http://www.ch-werner.de/rubyodbc/odbc.html. I assume it's available in the *NIX distro as well. In some ways, it's nicer than Perl's DBI. It might lack some features, but so far it's done everything I've needed, and with just a little practice, it's really pretty intuitive as well. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] XML Results Reports for Watir (for CruiseControl)
On 11/29/05, Yury Krasavin <[EMAIL PROTECTED]> wrote: > Finaly, I have posted an example of my Ruby/Watir test integration with > CruiseControl.NET here: > http://blogs.byte-force.com/buggins/archive/2005/11/29/704.aspx Thanks Yury for the example (and thanks Mr. Verkhovsky for Reporter). I'll be using your example very soon. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] OT: spectacularly neato online Ruby tutorial
Haven't tried it much yet, but this is too cool not to share: http://tryruby.hobix.com/ whytheluckystiff is one heckuvaguy. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] OT: help constructing interesting hash?
Hi all Again, apologies for the OT, stop me if it's not amusing... Suppose I have an array of arrays like [[A, B, C][1,2,3]] I can easily make a hash (using each.with_index) where one value is the lookup value for the other value: 1=>A 2=>B 3=>C Now suppose I have a AoA like [[A, B, C,][1,2,2]] Is there a readable way to construct a hash like 1=>A 2=>[B, C] ? Thanks, -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] install on new laptop?
> QUESTION: If I use the development version, can I revert to a more > stable version if there is a problem? FWIW, I always check out from HEAD. One of the (many) nice things about Watir is that the development versions are very rarely broken. And a re-install of any other particular version is easy, too. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] [OT] running watir in a VM
> QUESTION: Is anyone using watir in a setup like this? XP installed in > a VM using VMWare under fedora 3 or 4? No, but I'm replying anyway =) because I have nothing but good things to say about VMWare. Not long ago I had occasion to run FreeBSD under VMWare on Windows XP, doing some pretty sophisticated web stuff (Apache/Twiki) and network hacking (ntop, nessus, ettercap) and VMWare handled everything flawlessly. Very nice job on the part of the VMWare people. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] OT: Humane interfaces
Hi... I ran across this the other day, Martin Fowler discussing some principles of language design, demonstrating differences with Ruby's Array object and Java's List object: http://martinfowler.com/bliki/HumaneInterface.html. The other day I needed to iterate over every link in a page. When you realize exactly how much information is available through Watir about each link, (and how easy it is to get to that information), it seems that Watir really is a Humane Interface to the IE DOM. Thanks again for your indulgence of the OT... -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Non-blocking image click
On 12/10/05, Bret Pettichord <[EMAIL PROTECTED]> wrote: > Watir 1.5 will have a click method that will not only fail to block in your > scenario, but will also fail to block when raising modal dialogs (a case > where your code will still block). Ooooh. Aaaah Y'all may not realize how spectacular this is, but it's pretty darned neato. > Right now (in my uncommitted code) this is called "click_no_wait". Comments > please on the best name for this method. Is "click_nonblocking" better? How > about "click_dammit!"? So this is just me, but I *love* "dammit" methods. If it doesn't do what you think it should, then you're forced to RTFM. I think "click_popup_dammit" would be the best the best name. I'd use it, and not RTFM. It speaks to me. :) -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] selecting cells in Excell using activecell
> One fine day, I'll write a really good Ruby-Excel interface. Don't hold > your breath, though. :) > > ---Michael B. If you're serious, I know some people who might help. I know other people who'd use such an interface, too. Some encouragement: it's a classic example of a DSL, and we all know how easy it is do DSLs in Ruby. And you really need the practice implementing a Domain Specific Language, don't you? All the cool kids are doing it... -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] selecting cells in Excell using activecell
> I wonder how many people would be thrown by my desire to build objects like > CellPointers, and calls like > > p = CellPointer.new() > p.goto("$A$5") Go for it. What causes me to pull my hair out are the inability to address a cell by column number in the Range function; and all of the goofy numerical constants, like "-4161" to go to the end of the row. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Design Problems
Hi Terry... I hope better programmers than me comment, this is a really good question. > Right now I'm cluttering up my test case with a lot of conditionals/case > statements so that it can react accordingly, but that doesn't seem really > elegant to me. Does anyone know of a better way to do this? A general design rule of thumb is to substitute methods for conditionals. I know that sounds all abstract and stuff, but here's a concrete example. I have an app that shows 10 things at a time on an arbitrarily large number of pages. So I'll write a method like this: def check_for_next_page @ie.links.each do |link| if link.href =~ /b_start/ and link.text =~ /Next/ and link.text =~ /items/ process_next_page_method link.click end end end #def So above that I have another method that will process the page *if the page exists*: def process_next_page_method @ie.links.each do |link| if link.href =~ /IWantThisLink/ link.href =~/\d+/ @data_array<<$& #puts $& end end #def That way only one conditional per page, one conditional per link per page. I hope that makes sense, good luck. BTW, I bet if you google something like "ruby conditionals methods" you might find useful stuff, too. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] A testing framework
Hi Sergio > I recently spent sometime coming up with a simpler way to test my projects > running from nant and using xml as the test. I would love to get some > feedback on what ones think or ways that it can be improved. I have attached > the entire framework for your review. At a glance, I can see what you're doing here. (Although I'm sure I fail to grasp the finer points from such a quick look.) If you don't mind a couple of questions... Your XML tests seem to contain 3 elements, control_type, control_object, and control_action, of which some take parameters. What drove these design decisions? That is, it seems efficient and useful in context, I wonder the process by which you arrived at this design. Also, I'm about to have to integrate some Ruby (not Watir) tests with CC.NET, and it would be great to hear what you had to do to get your Ruby code to interact nicely with CruiseControl. Thanks... -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Random number generation.
> but do I need to precede every method name with > "test"? Yes. That's how test/unit works. > Secondly, I am trying to generate test users for my test by generating a > random number and the concatenating that number to a string "test" so that > the result is "test12345", for example. > > I'm using rand(max-0) to generate the number, but it returns a big number. > So I tried stripping the number and then concatenating but it didn't work. > Ultimately, I would like to have generate names with 5 digits randomly like > the example above. Any ideas? I stashed some code like this over at agilistas.org, stolen from Jeff Wood: def random_text( length ) output = "" length.times do output << ('A'..'Z').to_a[ rand(26) ] end output end then, where ever you need it : just call it random_text( 42 ) # for 42 chars of random text ... -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Access denied problem is driving me nuts
> > > 2. Why does placing an entry in my hosts file make my "access denied" > > > problems go away? > > > > > > Cross-site scripting is when when scripts from one site try to access > content from another. Today's browsers prevent this from happening. Watir > runs into to the same barriers when you navigate from a page hosted from one > site to a frame hosted by another. Your hosts file change makes all these > frames & pages come from a single site. I didn't know that. What a nice, easy workaround. > > It would be great if someone on this list would put together a wiki page > describing this problem. At the moment, I've got a million other things going on, but this is right up my alley. If anyone else wants this, please make some noise. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Modula test execution?
> I am new to ruby and watir, so this might be a very trivial question. Welcome! > > Is there a elegant solution to have a modular test script approach? > > I have blocks of code that will be always the same for the web-site I am > going to test, like "login", "search", "logout", etc. So my idea is to put > those modules into separate files and then call them from a script called > "testExecution.rb". What is your solution? This is a classic refactoring exercise. Look up "Module" in the Pickaxe, or look around at the Watir distro for some fairly advanced examples. (I'm doing this right now on my current project, once you start, you'll get the hang of it quickly.) -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Help with File.join(File.dirname(__FILE__), '..') ?
Hi... I have some tests in directories that share common code like suite_foo/ test_1.rb test_2.rb suite_bar/ test_3.rb test_4.rb common/ my_library.rb My test runner script dips into each directory and then back out: ## TOPDIR = File.join(File.dirname(__FILE__), '..') $LOAD_PATH.unshift TOPDIR require 'test/unit' test_dirs = Dir.glob("suite*") test_dirs.each do |dir| Dir.chdir(dir) test_cases = Dir.glob("*rb") test_cases.each {|f| require f } Dir.chdir("..") end #do ### is this a reasonable approach? It seems kinda thrashy to me, I wonder if there's a better way to go about this. -Chris ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Help with File.join(File.dirname(__FILE__), '..') ?
Interestingly, had a quick conversation with Jonathan Kohl who had run into weirdness with test/unit and with require. Here's what I have now, with require replace by backticks. It seems to be working well so far: TOPDIR = File.join(File.dirname(__FILE__), '..') $LOAD_PATH.unshift TOPDIR require 'test/unit' require 'fileutils' include FileUtils::Verbose test_dirs = Dir.glob("suite**") 0.upto(test_dirs.length - 1) do |dirnum| chdir(test_dirs[dirnum]) puts "" puts "working in #{test_dirs[dirnum]}" test_cases = Dir.glob("*rb") test_cases.each do |casex| puts "running #{casex}" test_result = `ruby #{casex}` puts test_result end chdir("..") end #do On 1/30/06, Bret Pettichord <[EMAIL PROTECTED]> wrote: > One problem with this is that if you have suite_foo/test_a.rb and > suite_bar/test_a.rb, the second test won't be run. A quick fix would be to > use "load" instead of "require". > > But better would be to use more of the pathname with require. Here's how i'd > do it: > > TOPDIR = File.join(File.dirname(__FILE__), '..') > $LOAD_PATH.unshift TOPDIR > tests = Dir["suite*/*.rb"] > tests.each {|t| require t} > > (I'd put the "require 'test/unit'" in the individual tests instead so that > they could also run singly.) > > Bret > > > On 1/30/06, Chris McMahon <[EMAIL PROTECTED]> wrote: > > > > Hi... > > > > I have some tests in directories that share common code like > > > > suite_foo/ > > test_1.rb > > test_2.rb > > suite_bar/ > > test_3.rb > > test_4.rb > > common/ > > my_library.rb > > > > My test runner script dips into each directory and then back out: > > > > ## > > TOPDIR = File.join(File.dirname(__FILE__), '..') > > $LOAD_PATH.unshift TOPDIR > > require 'test/unit' > > > > test_dirs = Dir.glob("suite*") > > test_dirs.each do |dir| > > Dir.chdir(dir) > > > > test_cases = Dir.glob("*rb") > > > > test_cases.each {|f| require f } > > > > Dir.chdir("..") > > > > end #do > > > ### > > > > is this a reasonable approach? It seems kinda thrashy to me, I wonder > > if there's a better way to go about this. > > > > -Chris > > > > ___ > > 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 mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Anyone use Test::Unit::Reporter? Fwd: Help with File.join(File.dirname(__FILE__), '..') ?
Hi again... I'm trying to integrate Test::Unit::Reporter with my little harness script below, and struggling. Ideally, I would pass each "test_cases" array to Reporter and it would Do The Right Thing, but that's not happening. ## #ORIGINAL WORKING SCRIPT TOPDIR = File.join(File.dirname(__FILE__), '..') $LOAD_PATH.unshift TOPDIR require 'test/unit' require 'fileutils' include FileUtils::Verbose test_dirs = Dir.glob("suite**") 0.upto(test_dirs.length - 1) do |dirnum| chdir(test_dirs[dirnum]) puts "" puts "working in #{test_dirs[dirnum]}" test_cases = Dir.glob("*rb") test_cases.each do |casex| puts "running #{casex}" test_result = `ruby #{casex}` puts test_result end chdir("..") end #do # # WHAT I WISH WOULD HAPPEN TOPDIR = File.join(File.dirname(__FILE__), '..') $LOAD_PATH.unshift TOPDIR require 'test/unit' require 'fileutils' include FileUtils::Verbose require 'test/unit/testsuite' require 'test/unit/ui/reporter/reporter' @test_cases = Test::Unit::TestSuite.new FileUtils.mkdir_p 'build/report' test_dirs = Dir.glob("suite*") 0.upto(test_dirs.length - 1) do |dirnum| chdir(test_dirs[dirnum]) puts "" puts "working in #{test_dirs[dirnum]}" @test_cases = Dir.glob("*rb") Test::Unit::UI::Reporter::Reporter.run(@test_cases, 'build/report', :xml) chdir("..") end #do ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general