In general, you don't.   because a normal user cannot either.

Hidden values are normally returned automatically by the browser when
a POST is performed when the other data is submitted, it's all under
the covers stuff that user's never see, and is one of the ways that
webservers keep track of which user is which, or try to prevent
spoofing of responses.  Since watir is driving the browser you have no
need to worry about those things as they will be taken care of just as
they would if a user were interacting with the browser.

(those would be a concern if we were automating at the HTTP level,
instead of the UI level.. like doing loadtesting..  but not for watir
work)

Disabled elements would not normally be interacted with by a user
unless some client side script changes the state.  That can happen
with a lot of fancy javascript controls that might for example set
something to be enabled when another object is clicked or mouseovered
etc.   In general for that kind of thing you kinda have to reverse
engineer the page, (this is where the 'what events have been fired'
info becomes very useful) and may have to write stuff into your
scripts that does things like clicks on specific elements, or fires
specific events such as 'onmouseover' against some specific
element.    Whenever you see something that 'reacts' such as a visual
change to the image, to the mouse moving over it, you can pretty much
be sure that this sort of event driven client side code is behind it

On Oct 18, 8:17 am, Joe Fleck <[email protected]> wrote:
> 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 readhttp://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/watir-generalwatir-general+unsubscribe...>

-- 
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]

Reply via email to