<input id="ctl00_subContent_userNameInput" type="text">
<label for="" id="ctl00_subContent_Label1">Username</label>
I added this to the end of Watir::TextField#set
what = @container.label(:for, @what).text
puts "- at text field '#{what}' enter '[#{what}]'"
and got
- at text field 'Username' enter '[Username]'
That is all I need. I added something similar to other methods. I have two questions.
1) Should I use @container or some other variable? It works.
2) How should I extract this? I do not want to modify watir.rb, because I would have to modify it every time I upgrade. At the moment I created new file howto.rb (at the end of e-mail). I require this file in my scripts. This is the only way I knew how to override Watir's methods. Is there a better way?
Thanks,
Zeljko
--
http://zeljkofilipin.com/
#howto.rb
module Watir
class TextField < InputElement
def set(setThis)
assert_enabled
assert_not_readonly
highlight(:set)
@o.scrollIntoView
@o.focus
@o.select
@o.fireEvent("onSelect")
@o.value = ""
@o.fireEvent("onKeyPress")
doKeyPress(setThis)
highlight(:clear)
@o.fireEvent("onChange")
@o.fireEvent("onBlur")
what = @container.label(:for, @what).text
$howto.puts "+at text field '#{what}' enter '[#{what}]'"
end
end
end
_______________________________________________ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general