[Wtr-general] Inheritance
This is not a watir, but a ruby question. In application under test, some items have attachments, some have description, and some have both. I know ruby does not support multiple inheritance, so I made class ItemDescriptionAttachment that has some redundant code (attr_reader :attachments and @attachments=attachments). Can class ItemDescriptionAttachment inherit attr_reader :attachments and @attachments=attachments from class ItemAttachment? Thaks. This is my code: class Item attr_reader :title def initialize(title) @title=title end end class ItemAttachment Item attr_reader :attachments def initialize(title,attachments=nil) super(title) @attachments=attachments end end class ItemDescription Item attr_reader :description def initialize(title,description=nil) super(title) @description=description end end class ItemDescriptionAttachment ItemDescription attr_reader :attachments def initialize(title,description=nil,attachments=nil) super(title,description) @attachments=attachments end end Zeljko ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] space in link text
Title: space in link text How can I click on a text-link in ruby, which contains a space between two words? Thanks! ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] RE: file_field.set
the title is the tooltip for the checkbox. We support this on other objects, so it should be simple to make it work on checkboxes too input type=checkbox title = 'a tooltip' Paul - Original Message - From: Bret Pettichord [EMAIL PROTECTED] Date: Monday, August 1, 2005 10:21 pm Subject: Re: [Wtr-general] RE: file_field.set I don't understand this request. Can you show the html that includes the title for a checkbox? I didn't realize this was possible. Bret At 07:26 AM 8/1/2005, Zeljko Filipin wrote: I would also like title support for other html elements (like checkbox). Zeljko -Original Message- From: Zeljko Filipin [EMAIL PROTECTED] Sent: Monday, August 01, 2005 1:26 PM To: wtr-general@rubyforge.org Subject: file_field.set 1) After I do: ie.file_field(:index,1).set('C:\file.txt') I get: Starting win setFileDialog in new process. Setting text C:\file.txt Starting app: C:/ruby/lib/ruby/site_ruby/1.8/watir/setFileDialog.rb C:\file.txt Is there a way to do this without this output? 2) After I do (there is a file field with this title at page): ie.file_field(:title,'title').set('C:\file.txt') I get: C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1939:in `assert_exists': Unable to locate object, using title and Document filename (Watir::Exception::UnknownObject Exception) from C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3099:in `set' ... Will title be supported for file fields? I would like it. Zeljko ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general _ Bret Pettichord www.pettichord.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
RE: [Wtr-general] space in link text
Title: space in link text .link(:text, Space Between Words).click Works for me, but if youre lazy: .link(:text, /Space/).click As long as the first link the regexp matches is the one you want clicked. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Neumann, Carsten - ENCOWAY Sent: Tuesday, August 02, 2005 9:03 AM To: wtr-general@rubyforge.org Subject: [Wtr-general] space in link text How can I click on a text-link in ruby, which contains a space between two words? Thanks! ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Pop up handling improvements
nice! Im not sure about remote_eval, but dialog.button is great. Unfortunately I have no suggestions for remote_eval. Paul - Original Message - From: Bret Pettichord [EMAIL PROTECTED] Date: Monday, August 1, 2005 10:04 am Subject: Re: [Wtr-general] Pop up handling improvements I have a scheme that doesn't require this code to be in separate ruby files at all. I've tested it out and it works. Right now, using this code looks like this: ie.remote_eval -END button(:name, 'foo').click END dialog.button('Yes').click I'd appreciate comments on this interface, and the names it uses (remote_eval, dialog). Note that the first button click is run in a separate process (that blocks). This allows the script actions to appear in a logical sequence, rather than the inverted one that you need when the dialog button click is in the remote process. Bret At 01:31 PM 7/27/2005, Paul Rogers wrote: The scripts that handle pop ups are in the unit test directory jscriptExtraAlert.rb jscriptExtraConfirmCancel.rb jscriptExtraConfirmOk.rb jscriptPushButton.rb I suggest we move these to a better location - The C:\ruby\lib\ruby\site_ruby\1.8\watir seems like the best place ( or maybe another dir below) We can then maybe add some methods to launch these from watir directly - ie.launch_js_confirm_clicker() Or similar. I think this would be one small step to making these popupseasier to deal with. Any suggestions? Paul ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general _ Bret Pettichord www.pettichord.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
RE: [Wtr-general] Using Asserts
Works for me: irb(main):010:0 require 'test/unit/assertions' = true irb(main):011:0 include Test::Unit::Assertions = Object irb(main):012:0 assert(true) = nil irb(main):013:0 assert(false) Test::Unit::AssertionFailedError: false is not true. from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:30:in `assert_block' from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:28:in `_wrap_assertion ' from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:28:in `assert_block' from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:40:in `assert' from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:38:in `_wrap_assertion ' from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:38:in `assert' from (irb):13 irb(main):014:0 At 05:08 PM 8/2/2005, Jonathan Kohl wrote: I haven t been able to get assertions to work in IRB when using Watir either. I do a require for both Watir and test::unit, but it gets into a strange state. I wanted to do this for live demos, but have had to hand-wave at this point, and then run a script that prints out the assertions. Maybe someone else has a suggestion. Out of curiosity, why do you want to do this in IRB instead of saving the tests in test files? -Jonathan -- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tuyet Cong-Ton-Nu Sent: August 2, 2005 4:04 PM To: wtr-general@rubyforge.org Subject: [Wtr-general] Using Asserts I still can t get Asserts commands to work in the irb. I got all the require statements correctly (they return true), but here are some asserts statements that don t give me back anything. Maybe I don t know how to use them or decipher whether it s true or false: irb(main):046:1 assert_true(ie.contains_text(none) irb(main):047:2 assert_true(ie.contains_text(%%%none) irb(main):048:3 rescue = e irb(main):049:3 puts e irb(main):050:3 I get nothing here! I expected it to fail since there is no such text on my IE page ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general _ Bret Pettichord www.pettichord.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Using Asserts
You need to balance your parentheses. At 05:04 PM 8/2/2005, Tuyet Cong-Ton-Nu wrote: I still can t get Asserts commands to work in the irb. I got all the require statements correctly (they return true), but here are some asserts statements that don t give me back anything. Maybe I don t know how to use them or decipher whether it s true or false: irb(main):046:1 assert_true(ie.contains_text(none) irb(main):047:2 assert_true(ie.contains_text(%%%none) irb(main):048:3 rescue = e irb(main):049:3 puts e irb(main):050:3 I get nothing here! I expected it to fail since there is no such text on my IE page ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general _ Bret Pettichord www.pettichord.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
RE: [Wtr-general] Using Asserts
Thanks. I've got it now. I wasn't doing a require 'test/unit/assertions' -- I was mistakenly doing require 'test/unit', and not including this: Test::Unit::Assertions. (smacks forehead) Paul gave me a couple pointers and I have this working like a charm: irb(main):001:0 require 'watir' = true irb(main):002:0 require 'test/unit/assertions' = true irb(main):003:0 include Test::Unit::Assertions = Object irb(main):004:0 ie = Watir::IE.new = #Watir::IE:0x2da5928 @form=nil, @ie=#WIN32OLE:0x2da58c8, @defaultSleepTime=0.1, @error_ch eckers=[#Proc:[EMAIL PROTECTED]:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1213], @logger=#Watir::Defa ultLogger:0x2da5868 @progname=nil, @logdev=#Logger::LogDevice:0x2da5808 @dev=#IO:0x2a6f370, @shift_size=nil, @shift_age=nil, @filename=nil, @level=2, @datetime_format=%d-%b-%Y %H:%M:%S , @typingspeed=0.08, @activeObjectHighLightColor=yellow, @enable_spinner=false, @url_list=[] irb(main):005:0 ie.goto(http://www.google.com;) = 0.391 irb(main):006:0 ie.text_field(:name, q).set(pickaxe) = nil irb(main):007:0 ie.button(:value, Google Search).click = nil irb(main):008:0 begin irb(main):009:1* assert(ie.contains_text(Programming Ruby) ) irb(main):010:1 puts(TEST PASSED. Found test string 'Programming Ruby' ) irb(main):011:1 rescue = e irb(main):012:1puts(TEST FAILED. + e.message + \n + e.backtrace.join(\n)) irb(main):013:1end TEST PASSED. Found test string 'Programming Ruby' = nil -Original Message- From: [EMAIL PROTECTED] [mailto:wtr-general- [EMAIL PROTECTED] On Behalf Of Bret Pettichord Sent: August 2, 2005 4:40 PM To: wtr-general@rubyforge.org Subject: RE: [Wtr-general] Using Asserts Works for me: irb(main):010:0 require 'test/unit/assertions' = true irb(main):011:0 include Test::Unit::Assertions = Object irb(main):012:0 assert(true) = nil irb(main):013:0 assert(false) Test::Unit::AssertionFailedError: false is not true. from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:30:in `assert_block' from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:28:in `_wrap_assertion ' from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:28:in `assert_block' from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:40:in `assert' from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:38:in `_wrap_assertion ' from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:38:in `assert' from (irb):13 irb(main):014:0 At 05:08 PM 8/2/2005, Jonathan Kohl wrote: I haven t been able to get assertions to work in IRB when using Watir either. I do a require for both Watir and test::unit, but it gets into a strange state. I wanted to do this for live demos, but have had to hand-wave at this point, and then run a script that prints out the assertions. Maybe someone else has a suggestion. Out of curiosity, why do you want to do this in IRB instead of saving the tests in test files? -Jonathan -- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tuyet Cong-Ton-Nu Sent: August 2, 2005 4:04 PM To: wtr-general@rubyforge.org Subject: [Wtr-general] Using Asserts I still can t get Asserts commands to work in the irb. I got all the require statements correctly (they return true), but here are some asserts statements that don t give me back anything. Maybe I don t know how to use them or decipher whether it s true or false: irb(main):046:1 assert_true(ie.contains_text(none) irb(main):047:2 assert_true(ie.contains_text(%%%none) irb(main):048:3 rescue = e irb(main):049:3 puts e irb(main):050:3 I get nothing here! I expected it to fail since there is no such text on my IE page ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general _ Bret Pettichord www.pettichord.com ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] I have a couple of questions...
Wow, thanks for the quick response ... So, with the .link or .frame or .blah calls, what do they return if it can't find the item ? or if it finds multiple? j. On 8/2/05, Paul Rogers [EMAIL PROTECTED] wrote: 1. no - you must specify the frame, like ie.frame(:index,2).link(:id,'blah').click 2. yes, but you have to use the Autoit tool to help you, its not too hard though. Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Wood Sent: 02 August 2005 20:37 To: wtr-general@rubyforge.org Subject: [Wtr-general] I have a couple of questions... I haven't gotten a computer setup with WATiR yet, but I wanted to see if I could get an answer before I got to it... #1 - If I do something like ie.link( :id, blah ) will it find the link regardless of frame on the page? or do I have to add stuff to specify the frame then the link within it... #2 - If an auth dialog pops up, can I fill in the fields @ run time ... I know if the browser shows the login as part of a web page, I can set the text and submit, but I want to know, if it's truly AUTH based HTTP, will it let me fill in THOSE? I know I can do that with information in the URL, but I want to know about the dialog option. j. -- So long, and thanks for all the fish 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 -- So long, and thanks for all the fish Jeff Wood ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
RE: [Wtr-general] I have a couple of questions...
If it cant find it, it raises an ObjectNotFoundException. If there are multiple, it returns the first one. There have been suggestions we should raise an exception if there are multiple. Im not sure, as there is nothing preventing you from having the same name or id on html tags in the page. Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Wood Sent: 02 August 2005 20:58 To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] I have a couple of questions... Wow, thanks for the quick response ... So, with the .link or .frame or .blah calls, what do they return if it can't find the item ? or if it finds multiple? j. On 8/2/05, Paul Rogers [EMAIL PROTECTED] wrote: 1. no - you must specify the frame, like ie.frame(:index,2).link(:id,'blah').click 2. yes, but you have to use the Autoit tool to help you, its not too hard though. Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Wood Sent: 02 August 2005 20:37 To: wtr-general@rubyforge.org Subject: [Wtr-general] I have a couple of questions... I haven't gotten a computer setup with WATiR yet, but I wanted to see if I could get an answer before I got to it... #1 - If I do something like ie.link( :id, blah ) will it find the link regardless of frame on the page? or do I have to add stuff to specify the frame then the link within it... #2 - If an auth dialog pops up, can I fill in the fields @ run time ... I know if the browser shows the login as part of a web page, I can set the text and submit, but I want to know, if it's truly AUTH based HTTP, will it let me fill in THOSE? I know I can do that with information in the URL, but I want to know about the dialog option. j. -- So long, and thanks for all the fish 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 -- So long, and thanks for all the fish 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] I have a couple of questions...
I don't mind the return the first one ... 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 ). Thanks for the blazing results... As soon as I get my testing dialed in, I'm going to show this to the company I work for ... I think I can get a pretty major following for this. ( we're a mid-large sized eComm company located in Seattle ). From what I've seen so far, WATiR looks like it's going to solve a LOT of problems for me. Thank you for developing it. j. On 8/2/05, Paul Rogers [EMAIL PROTECTED] wrote: If it cant find it, it raises an ObjectNotFoundException. If there are multiple, it returns the first one. There have been suggestions we should raise an exception if there are multiple. Im not sure, as there is nothing preventing you from having the same name or id on html tags in the page. Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Wood Sent: 02 August 2005 20:58 To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] I have a couple of questions... Wow, thanks for the quick response ... So, with the .link or .frame or .blah calls, what do they return if it can't find the item ? or if it finds multiple? j. On 8/2/05, Paul Rogers [EMAIL PROTECTED] wrote: 1. no - you must specify the frame, like ie.frame(:index,2).link(:id,'blah').click 2. yes, but you have to use the Autoit tool to help you, its not too hard though. Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Wood Sent: 02 August 2005 20:37 To: wtr-general@rubyforge.org Subject: [Wtr-general] I have a couple of questions... I haven't gotten a computer setup with WATiR yet, but I wanted to see if I could get an answer before I got to it... #1 - If I do something like ie.link( :id, blah ) will it find the link regardless of frame on the page? or do I have to add stuff to specify the frame then the link within it... #2 - If an auth dialog pops up, can I fill in the fields @ run time ... I know if the browser shows the login as part of a web page, I can set the text and submit, but I want to know, if it's truly AUTH based HTTP, will it let me fill in THOSE? I know I can do that with information in the URL, but I want to know about the dialog option. j. -- So long, and thanks for all the fish 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 -- So long, and thanks for all the fish 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 -- So long, and thanks for all the fish Jeff Wood ___ 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