Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

NoMethodError: undefined method `set' for #<Watir::TextArea:0x007fb73b21cbc8> #118

Closed
zeljkofilipin opened this Issue · 9 comments

4 participants

@zeljkofilipin
$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]

$ gem -v
1.8.15

$ gem list selenium-webdriver
*** LOCAL GEMS ***
selenium-webdriver (2.17.0)

$ gem list watir-webdriver
*** LOCAL GEMS ***
watir-webdriver (0.4.1)

$ irb
> require "watir-webdriver"
 => true 

> browser = Watir::Browser.new :firefox
 => #<Watir::Browser:0x787eb29124fb7658 url="about:blank" title=""> 

> browser.goto "http://bit.ly/watir-example"
 => "https://spreadsheets.google.com/viewform?hl=en&formkey=dDliTk5XU1R4RUMtb2c1WDZxWHNENmc6MQ#gid=0"

> browser.element(:css => "textarea").to_subtype.set "text"
NoMethodError: undefined method `set' for #<Watir::TextArea:0x007fb73b21cbc8>
from /Users/zeljko/.rvm/gems/ruby-1.9.3-p0/gems/watir-webdriver-0.4.1/lib/watir-webdriver/elements/element.rb:317:in `method_missing'
from (irb):6
from /Users/zeljko/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>'

Environment: Mac OS X 10.7.2, Firefox 9.0.1.

@zeljkofilipin

There is a workaround:

browser.element(:css => "textarea").send_keys "text"
@zeljkofilipin
> browser.element(css: "textarea").to_subtype.clear
NoMethodError: undefined method `clear' for #<Watir::TextArea:0x007f8e222277e0>
from /Users/zeljko/.rvm/gems/ruby-1.9.3-p0/gems/watir-webdriver-0.4.1/lib/watir-webdriver/elements/element.rb:317:in `method_missing'
from (irb):8
from /Users/zeljko/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>'
@jarib
Owner

@jarmo - does Watir support .textarea in addition to .text_field?

@jarib jarib closed this in 085795a
@jarib
Owner

I was a bit unsure about where to spec this, since I'm not sure how Watir behaves, but ended up adding it to watirspec.

@jarmo
Owner

I'm not sure it does. IMHO it's #text_field, but why not have alias :text_area :text_field instead of creating new class TextArea. Is there anything different between TextField?

@jarib
Owner

It's a separate element type in the DOM / spec, which is why it exists as a separate thing. A TextField is basically <textarea>and <input> text types combined. The spec I wrote uses browser.textarea, but if we change it to use :css or :xpath it'll probably pass with Watir as well. Perhaps that's good enough?

@hemanth

Same issue for @browser.elements(:class => "input[type=password]")[1].to_subtype.set pass with 0.6.2

@jarib
Owner

@hemanth: Looks like a separate issue. The bug there is that you don't get an UnknownObjectException, since you're using :class and not :css.

@hemanth

@jarib Had the same with :css, rather :css is what I meant! Will cross check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.