Hi, One last issue. How do i deal with file_fields that are hidden or disabled?
Joe On Tue, Oct 18, 2011 at 10:51 AM, Joe Fleck <[email protected]> wrote: > Hello, > > Got it! :-) > > changed the id: and it works. > > @browser.file_field(:id, "file_attachment_attachment") > > Thank you all again for your help. > > Joe > > > On Tue, Oct 18, 2011 at 10:19 AM, Joe Fleck <[email protected]> wrote: > >> Hi, >> >> Thank you all for helping. I really appreciate it. >> >> I believe the file path is correct now because the error message I am now >> getting has changed. >> >> Code: >> #Attach file >> @browser.file_field(:id, >> "the_file").set("/Users/josephfleck/Documents/DownloadDocs/DataFile.xls") >> >> It doesn't object name i am giving it. Do I need to use something else >> like the actual object name of the text field? >> >> >> /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.4/lib/watir-webdriver/elements/element.rb:248:in >> `assert_exists': unable to locate element, using {:type=>"file", >> :tag_name=>"input", :id=>"the_file"} >> (Watir::Exception::UnknownObjectException) >> from >> /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.4/lib/watir-webdriver/elements/file_field.rb:23:in >> `value=' >> from >> /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.4/lib/watir-webdriver/elements/file_field.rb:14:in >> `set' >> from ./common/helper_methods.rb:182:in `share_documents' >> from >> /Users/josephfleck/Sites/within3/qa_automation/discussion/add_multiple_discussion.rb:159 >> from >> /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:696:in >> `each' >> from >> /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:696:in >> `each' >> from >> /Users/josephfleck/Sites/within3/qa_automation/discussion/add_multiple_discussion.rb:38 >> >> On Tue, Oct 18, 2011 at 9:28 AM, Joe DiMauro <[email protected]> wrote: >> >>> Another thing I noticed. Due to the path ending with >>> \criptDataFile.xls >>> >>> It appers that the backslash followed by the two characters "cr" >>> is being interpeted as a Carridge Return. You can see this >>> in the error message: >>> >>> No such file or directory - Users/josephfleck/Documents/Download >>> Docs/ iptDataFile.xls (Errno::ENOENT) >>> ^ >>> Notice the space instead of the characters"cr" indicating >>> that \cr was interpreted as a Carriage Return, not the first >>> two characters in the file name "criptDataFile.xls" >>> >>> >>> So try all these: >>> 1. Use a full pathname, not a relative path (as previously mentioned) >>> Unless Ruby is running with the Root level of your Mac as it >>> working >>> directory, (which I'm pretty sure its not), then the Users >>> directory will not be a valid relative path.) >>> >>> 2. Remove the backslashes. They are not necessary on Mac/Linus OS, >>> (as previously mentioned), and may cause issues (e.g. \cr) >>> >>> 3. Always a good idea (as previously mentioned), to upgrade to the >>> latest version of the gems, (and Ruby if possible) >>> >>> If you are also running safariWatir you may not be able to upgrade >>> to Ruby 1.9.x. I don't recall if safariWatir supports 1.9.x yet. >>> >>> 4. The space in the directory name should not be an issue, since the >>> full path is quoted, but whenever possible using directory >>> and file names without spaces is always safer. >>> >>> >>> Joe DiMauro >>> >>> >>> On Oct 17, 4:42 pm, Chuck van der Linden <[email protected]> wrote: >>> > or escape the space with a backslash? same as you are doing for the >>> > slashes? (but Michael's solution of using double-quotes might be even >>> > easier) >>> > >>> > On Oct 17, 1:50 pm, Željko Filipin <[email protected]> >>> > wrote: >>> > >>> > > On Mon, Oct 17, 2011 at 10:01 PM, Joe Fleck <[email protected]> >>> wrote: >>> > > > No such file or directory - Users/josephfleck/Documents/Download >>> Docs/ >>> > >>> > > iptDataFile.xls >>> > >>> > > Try putting the file in a folder that has no spaces, something >>> > > like Users/josephfleck >>> > >>> > > Željko >>> >>> -- >>> Before posting, please read http://watir.com/support. In short: search >>> before you ask, be nice. >>> >>> [email protected] >>> http://groups.google.com/group/watir-general >>> [email protected]<http://groups.google.com/group/[email protected]> >>> >> >> > -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected]
