[wtr-general] Re: How can I add a new method to Watir::Radio?
Try looking at where the radio methods are defined in watir, that should give you a clue. In input_elements.rb, the declaration of Radio functions look like this: Module Watir class Radio RadioCheckCommon def myMethod puts this is my method end end end -Dylan On Aug 11, 12:56 am, John Kolokotronis johnj...@gmail.com wrote: Hi All, I thought my understanding of Ruby classes was getting a bit better but I can't seem to add a new method to Watir::Radio, without breaking all functionality for radio buttons... E.g. I tried adding a dummy method like this: class Watir::Radio def myMethod puts this is my method end end When I then call the method or any other existing method, like isSet?, I get error messages about the number of arguments given: wrong number of arguments (4 for 0) whenever I try to call any method from the Watir::Radio class. What I'm doing wrong? How can I extend Watir::Radio, without messing with the main watir.rb files? Thanks in advance. Regards, John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: How can I add a new method to Watir::Radio?
Thanks - I noticed the Radio class is in input_elements.rb and tried the structure you suggested before my original post: module Watir class Radio RadioCheckCommon def myMethod puts this is my method end end end But this just generates another error: uninitialized constant Watir::RadioCheckCommon (NameError) And the script can't be executed at all then... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: How can I add a new method to Watir::Radio?
Try adding require 'watir/ie' after your require 'watir' line -Dylan On Aug 11, 2:03 am, John Kolokotronis johnj...@gmail.com wrote: Thanks - I noticed the Radio class is in input_elements.rb and tried the structure you suggested before my original post: module Watir class Radio RadioCheckCommon def myMethod puts this is my method end end end But this just generates another error: uninitialized constant Watir::RadioCheckCommon (NameError) And the script can't be executed at all then... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: How can I add a new method to Watir::Radio?
You need to show us more code. E.g. what method is giving you this error? Also send us the backtrace. Bret On Aug 11, 2:56 am, John Kolokotronis johnj...@gmail.com wrote: Hi All, I thought my understanding of Ruby classes was getting a bit better but I can't seem to add a new method to Watir::Radio, without breaking all functionality for radio buttons... E.g. I tried adding a dummy method like this: class Watir::Radio def myMethod puts this is my method end end When I then call the method or any other existing method, like isSet?, I get error messages about the number of arguments given: wrong number of arguments (4 for 0) whenever I try to call any method from the Watir::Radio class. What I'm doing wrong? How can I extend Watir::Radio, without messing with the main watir.rb files? Thanks in advance. Regards, John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---