Re: [Wtr-general] How can I make a IE window active?
Hi Zeljko, It worked. Thanks a lot. Now I'm happy again :) Claudiu ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Path error or what?
I am having a weird issue. I hope someone can clear it up... this was never a problem before. Sometimes I have need to start up Watir from the command line. So when I start IRB from c:\, then require 'watir', everything works fine. (Ruby and gems are installed under c:\ruby). But now, if I start up irb in another directory, or on another drive, watir is not being found or something. I get a "load error" stating that C:\current_directory\watir\IEDialog\Release\IEDialog.dll could not be found. When I try to attach to an IE window, I get the error "uninitialized constant IE". Is this some kind of path error? I have never encountered this before. It always worked fine, no matter where I started it up. Lonny Eachus === [EMAIL PROTECTED] wrote: Send Wtr-general mailing list submissions to wtr-general@rubyforge.org To subscribe or unsubscribe via the World Wide Web, visit http://rubyforge.org/mailman/listinfo/wtr-general or, via email, send a message with subject or body 'help' to [EMAIL PROTECTED] You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than "Re: Contents of Wtr-general digest..." Today's Topics: 1. Re: need help on Data Driven (Charley Baker) 2. Re: How to pick the last word in the sentence (marekj) 3. Re: How to pick the last word in the sentence (Paul Rogers) 4. Re: Selecting controls in a dialog box (Matt Berney) 5. Re: Selecting controls in a dialog box (Paul Rogers) 6. Re: Selecting controls in a dialog box (Bret Pettichord) 7. How to access the window.status pane (marty) Subject: Re: [Wtr-general] need help on Data Driven From: "Charley Baker" [EMAIL PROTECTED] Date: Tue, 10 Jul 2007 11:25:51 -0600 To: wtr-general@rubyforge.org To: wtr-general@rubyforge.org The error pretty much tells you the story. You're taking an array: category=worksheet.Range('a2:a4') ['Value'] and pushing it into a method that accepts a string. If you want the whole array to be a string then convert it to a string: category=worksheet.Range('a2:a4') ['Value'] category.to_s If that's not the intention, then grab whatever string you want and pass that on - cycle through the array, whatever. -Charley On 7/9/07, murali [EMAIL PROTECTED] wrote: Hi every one, iam facing problem with the data driven. have glance of my code and let me know where i did mistake. excel= WIN32OLE::new('excel.Application') workbook=excel.Workbooks.Open ('D:\Documents and Settings\mmopur\Desktop\IPE Aut\test.xls') worksheet=workbook.Worksheets(1) worksheet.Select excel ['Visible'] #worksheet.Range('a2') ['Value'] category=worksheet.Range ('a2:a4') ['Value'] line = '1' while worksheet.Range("a#{line}")['Value'] line.succ! ie.text_field(:name,"ctl00$ContentPlaceHolder1$txtCategory").set(category) when i run the script iam getting the errors as belo mentioned c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3431:in `+': can't convert Array into S ring (TypeError) from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3431:in `doKeyPress' from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3427:in `each' from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3427:in `doKeyPress' from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3393:in `set' from D:/Documents and Settings/mmopur/Desktop/IPE Aut/datadriven.rb:59 plz look into that and do needful Regards Murali ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general Subject: Re: [Wtr-general] How to pick the last word in the sentence From: marekj [EMAIL PROTECTED] Date: Tue, 10 Jul 2007 12:38:16 -0500 To: wtr-general@rubyforge.org To: wtr-general@rubyforge.org Hm...how about this: sentences =eof some words and more words then some more words and the last one word in a sentence1. Next sentence and more words and the last one word in a sentence2. and here too and then some more here and last word of the last sentence. eof words = sentences.split # or add (' ') to make split on whitespace explicit. last_word = words[-1] #last element in Array is your last word in a heredoc take a look at String.split goodness. http://www.ruby-doc.org/core/classes/String.html#M000818 marekj On 7/9/07, sapna [EMAIL PROTECTED] wrote: Hi All, Pleas can you help me finding out the last word in the sentence displayed on the web page. Have look at the HTML snippet. Regards Sapna
[Wtr-general] How to retreive the Frame Title
Hi, I need to verify the Frame title and Content inside the frame. I tried by using this code require 'watir' include Watir require 'test/unit' class TC_title Test::Unit::TestCase def test_title ie = IE.new ie.goto(https://login.aspx') ie.link(:url, https///FaqPage.aspx').click ie = Watir::IE.attach(:url, https///FaqPage.aspx'/FaqPage.aspx') puts ie.frame(:index, 2).title() end end I am getting the following error... ruby test.rb Loaded suite test Started E Finished in 6.562 seconds. 1) Error: test_recorded(TC_recorded): NoMethodError: undefined method `document' for nil:NilClass c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1237:in `title' test.rb:10:in `test_recorded' 1 tests, 0 assertions, 0 failures, 1 errors Exit code: 1 Please let me know how to get and verify the frame title . Thanks in advance Regards Vamsi ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to access the window.status pane
On 7/10/07, Paul Rogers [EMAIL PROTECTED] wrote: ie.status I did not know this exists. This is so wiki page material. http://wiki.openqa.org/display/WTR/How+To Zeljko -- ZeljkoFilipin.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to retreive the Frame Title
you dont need this line: ie = Watir::IE.attach(:url, https///FaqPage.aspx'/FaqPage.aspx') or if its a new window, use a different name, it will help understanding Which is line 10? I dont think frames have titles - where would you see it? try just ie.title to get the title of the displayed window - Original Message - From: vamsi [EMAIL PROTECTED] Date: Wednesday, July 11, 2007 6:52 am Subject: [Wtr-general] How to retreive the Frame Title To: wtr-general@rubyforge.org Hi, I need to verify the Frame title and Content inside the frame. I tried by using this code require 'watir' include Watir require 'test/unit' class TC_title Test::Unit::TestCase def test_title ie = IE.new ie.goto(https://login.aspx') ie.link(:url, https///FaqPage.aspx').click ie = Watir::IE.attach(:url, https///FaqPage.aspx'/FaqPage.aspx') puts ie.frame(:index, 2).title() end end I am getting the following error... ruby test.rb Loaded suite test Started E Finished in 6.562 seconds. 1) Error: test_recorded(TC_recorded): NoMethodError: undefined method `document' for nil:NilClass c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1237:in `title' test.rb:10:in `test_recorded' 1 tests, 0 assertions, 0 failures, 1 errors Exit code: 1 Please let me know how to get and verify the frame title . Thanks in advance Regards Vamsi ___ 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] Concurrent Threads and different variables in each thread
What would you suggest for running mutiple threads, BUT each thread using different variables. I've 'stolen' the following code from Brett (thanks!) which does exactly as expected, BUT how would I, for instance, search for a different value (instead of 'pickaxe') in each thread? require 'thread' require 'watir' def test_google ie = Watir::IE.start('http://www.google.com') ie.text_field(:name, q).set('pickaxe') ie.button(:value, Google Search).click ie.html ie.close end threads = [] 3.times do threads Thread.new {test_google} end threads.each {|x| x.join} Could I pass some arguments to +Thread.new(args)+, or should I simply create 3 threads as such: a = Thread.new { yada yada } b = Thread.new { yada yada } c = Thread.new { yada yada } I also don't quite understand why the *threads.each {|x| x.join}* command exists ? ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Concurrent Threads and different variables in each thread
Ahhh... maybe, just MAYBE, I should try something before I give up and post. This appeared to work: require 'thread' require 'watir' @var1='pickaxe' @var2='axepick' @var3='pckexai' def test_google(varvar) ie = Watir::IE.start('http://www.google.com') ie.text_field(:name, q).set(varvar) ie.button(:value, Google Search).click ie.html ie.close end a=Thread.new {test_google(@var1)} b=Thread.new {test_google(@var2)} c=Thread.new {test_google(@var3)} a.join b.join c.join It's not pretty, and if I wanted 5 or 20 threads it would mean writing these lines of code 10 or 40 times. Must be a cleaner way? ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Concurrent Threads and different variables in each thread
Must be a cleaner way? Yes - an array - you'll figure it out ;-) - Original Message - From: Jason [EMAIL PROTECTED] Date: Wednesday, July 11, 2007 9:37 am Subject: Re: [Wtr-general] Concurrent Threads and different variables in each thread To: wtr-general@rubyforge.org Ahhh... maybe, just MAYBE, I should try something before I give up and post. This appeared to work: require 'thread' require 'watir' @var1='pickaxe' @var2='axepick' @var3='pckexai' def test_google(varvar) ie = Watir::IE.start('http://www.google.com') ie.text_field(:name, q).set(varvar) ie.button(:value, Google Search).click ie.html ie.close end a=Thread.new {test_google(@var1)} b=Thread.new {test_google(@var2)} c=Thread.new {test_google(@var3)} a.join b.join c.join It's not pretty, and if I wanted 5 or 20 threads it would mean writing these lines of code 10 or 40 times. Must be a cleaner way? ___ 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] Selecting controls in a dialog box
A quick check will tell you if it's a modal dialog. Open ie to the page that launches the dialog. Open irb in a command window. In irb type: require 'watir' ie = Watir::IE.attach(:title, /some part of the ie title/) Launch the dialog. Back in irb type: puts ie.modal_dialog.title If you get a title string then you've got an ie modal dialog which you can interact with using ie.modal_dialog The tricky thing with modal dialogs is getting the controls. You can dump the html into a file, pop it open using ie and then use ie developer toolbar on it. -Charley On 7/10/07, Bret Pettichord [EMAIL PROTECTED] wrote: Paul Rogers wrote: have you looked at the modal_dialog stuff in watir? Ive never used it so cant help you much, but its there. +1 ___ 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] Concurrent Threads and different variables
Yes - an array - you'll figure it out ;-) Nice. Appreciate your confidence. Appears to do the trick: threads = [] @varvar.each do |searchterm| threads Thread.new {test_google(searchterm)} end threads.each {|x| x.join} ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Selecting controls in a dialog box
It seems like I am having troubles with Ruby v1.8.5 and the modal_dialog support. Should I roll back to 1.8.2-14? I was reading a post by Bret the other day saying that there may be issues with newer versions of Ruby. I am using: ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-mswin32] watir 1.5.1.1192 irb(main):006:0* b.modal_dialog.title NoMethodError: IE#modal_dialog not supported with the current version of Ruby (1.8.5). See http://jira.openqa.org/browse/WTR-2 for details. undefined method `connect_unknown' for WIN32OLE:Class from d:/tools/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1192/./watir.rb:28 27:in `initialize' from d:/tools/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1192/./watir.rb:32 5:in `new' from d:/tools/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1192/./watir.rb:32 5:in `modal_dialog' from (irb):6 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Selecting controls in a dialog box
yes, modal dialogs are only supported using that particular version - Original Message - From: Matt Berney [EMAIL PROTECTED] Date: Wednesday, July 11, 2007 11:09 am Subject: Re: [Wtr-general] Selecting controls in a dialog box To: wtr-general@rubyforge.org It seems like I am having troubles with Ruby v1.8.5 and the modal_dialog support. Should I roll back to 1.8.2- 14? I was reading a post by Bret the other day saying that there may be issues with newer versions of Ruby. I am using: ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-mswin32] watir 1.5.1.1192 irb(main):006:0* b.modal_dialog.title NoMethodError: IE#modal_dialog not supported with the current version of Ruby (1.8.5). See http://jira.openqa.org/browse/WTR-2 for details. undefined method `connect_unknown' for WIN32OLE:Class from d:/tools/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1192/./watir.rb:28 27:in `initialize' from d:/tools/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1192/./watir.rb:32 5:in `new' from d:/tools/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1192/./watir.rb:32 5:in `modal_dialog' from (irb):6 ___ 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] Selecting controls in a dialog box
No way!!! It works!!! Uninstalling 1.8.5 and installing 1.8.2-15 worked like a champ!!! This required installing gem watir-1192 as well as installing gem win32-process. But other than that, it works just as advertised... ie = Watir::IE.attach(:url,/ticket.aspx/) ie.button(:name,button).click == opens modal dialog ie.modal_dialog.select_list(:id,comboBox).select(item) ie.modal_dialog.text_field(:id,text).set(Comments) ie.modal_dialog.button(:name,btnContinue).click Thanks again for all the help!!! ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Keyword driven framework around Watir
Hi First all let me have the privilege of starting the very first discussion here at Google groups :). i am working with Crestech Software Systems and we are trying to build a keyword driven framework around Watir. I am trying to write a function to create an Object repository.. I need some feedback from the group memebers, any advices, experiences, suggestions regarding this issue are more then welcome and looking forward for some divine interventions. Thanks Regards, --- Pallavi Crestech Software Systems. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] How to click a row from table in webpage
Hi all, Please tell me how to click a column of a row of a web page. Regards shalini Gupta ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Keyword driven framework around Watir
Hi, I've build a simple framework around TestObject modelling at one company. I am in the middle of specifying and building something like that again. It's much easier second time around. What I've found out is that it is useful to model Business Domain Objects with Ruby classes by building some kind of Adapters or facade type pattersn and wire them up to talk to Watir code So for example if a Page has a Query TestObject that has 3 attributes :street, :city, :zip and you can invoke a search with those attributes I would model it like this: class Query TestObject def set_city end def set_street end def set_zip end def search end end Now I can write many tests by flooding the TestObject with query configurations and searching them. my data model comes first query=[:city, 'Seattle', :street, 'Stoneway', :zip, '9'] q = Query.new q.set_city(query[:city]) q.set_street(query[:zip]) q.set_zip(query[:zip]) q.search ... then capture search results and do some asserts. By making a Facade using Domain Model vocabulary I can then wire Watir code in it. def set_city(v) $ie.text_edit(:name, city_str).set(v) end Watir implementation is encapusalted. The tests can be written by anyone who interacts with Domain Model objects. the watir code si written later. Is this something you have in mind? marekj On 7/12/07, Pallavi [EMAIL PROTECTED] wrote: Hi First all let me have the privilege of starting the very first discussion here at Google groups :). i am working with Crestech Software Systems and we are trying to build a keyword driven framework around Watir. I am trying to write a function to create an Object repository.. I need some feedback from the group memebers, any advices, experiences, suggestions regarding this issue are more then welcome and looking forward for some divine interventions. Thanks Regards, --- Pallavi Crestech Software Systems. ___ 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] Concurrent Threads and different variables in each thread
if you don't join the threads the execution will stop when program exists. On 7/11/07, Jason [EMAIL PROTECTED] wrote: Ahhh... maybe, just MAYBE, I should try something before I give up and post. This appeared to work: require 'thread' require 'watir' @var1='pickaxe' @var2='axepick' @var3='pckexai' def test_google(varvar) ie = Watir::IE.start('http://www.google.com') ie.text_field(:name, q).set(varvar) ie.button(:value, Google Search).click ie.html ie.close end a=Thread.new {test_google(@var1)} b=Thread.new {test_google(@var2)} c=Thread.new {test_google(@var3)} a.join b.join c.join It's not pretty, and if I wanted 5 or 20 threads it would mean writing these lines of code 10 or 40 times. Must be a cleaner way? ___ 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