the html on the page contains:
<input type="File" name="File" size="70" value="" class="inputfield_en">
I’m trying to set the value using ruby (1.9.2) and watir-webdriver (0.3.5)
@browser.file_field(:type=>"File",:name=>"File",:class=>"inputfield_en").to_subtype.set("#{Dir.pwd}/status_feed_for_test.xml")
But I get:
.rvm/gems/ruby-1.9.2-p290/gems/watir-webdriver-0.3.5/lib/watir-webdriver/elements/element.rb:248:in `assert_exists': unable to locate element, using {:type=>"file", :name=>"File", :class=>"inputfield_en", :tag_name=>"input"} (Watir::Exception::UnknownObjectException)
Is this because the html contains type File with a capital “F”? (I have no control of the HTML). How to fix?
In watir, you only need to specify as many selectors as necessary to uniquely identify the element. In this case, you probably only need
:name.Update: It appears that you’ve encountered a bug in watir-webdriver where
file_fieldonly selects a field with lowercasetype="file". You may want to try a more generic selection method: