The problem with this approach is that the 'set' call sets the value to that path. It erases any previous changes made, it doesn't append to it.
On Friday, May 13, 2016 at 10:48:05 AM UTC-7, johnssn wrote: > > Maybe something like this. First thing to try, anyway. Method may take > multiple file args, can't remember offhand > > # http://www.rubydoc.info/gems/watir-webdriver/Watir/FileField > > × > ['path/one.txt', 'path/two.txt'].each do |path| > b.file_field(:id, 'some_id').when_present.set(path) > end > > > > > ------------------------------ > *From:* "[email protected] <javascript:>" <[email protected] > <javascript:>> > *To:* Watir General <[email protected] <javascript:>> > *Cc:* [email protected] <javascript:> > *Sent:* Friday, May 13, 2016 10:39 AM > *Subject:* Re: [wtr-general] Upload multiple files to input element? > > It's just a standard input field > ```<input name="files[]" type="file" accept="application/json" id="files" > multiple="multiple">``` > > It accepts multiple, I'm just not sure how to do that... > I've tried using `input_element.set paths` with the 'paths' variable as > the following: > ``` > paths = ("/path/to/file/1"; "/path/to/file/2") > paths = ["/path/to/file/1", "/path/to/file/2"] > paths = "'path/to/file/1', 'path/to/file/2'" > ``` > > On Friday, May 13, 2016 at 6:58:33 AM UTC-7, johnssn wrote: > > Hi Jesse, > > What have you tried, what does the HTML look like and what kind of errors > are you getting? It could be many things and that info might narrow down > the possibilities a bit. > > John > > ------------------------------ > *From:* "[email protected]" <[email protected]> > *To:* Watir General <watir-...@googlegroups. com> > *Sent:* Thursday, May 12, 2016 7:36 PM > *Subject:* [wtr-general] Upload multiple files to input element? > > Hello everyone > > I'm having a bit of difficulty trying to automate something that is a > fairly standard procedure. There is an input element on the page, that > accepts multiple, and I need to upload multiple files to this. I haven't > been able to find anything on any of the major forums, so I figured I'd > post here and see if any of you know of a solution. Thanks! > > Cheers, > Jesse > -- > -- > 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 > <http://groups.google.com/group/watir-general> > watir-genera...@ googlegroups.com > > --- > You received this message because you are subscribed to the Google Groups > "Watir General" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to watir-genera...@ googlegroups.com. > > For more options, visit https://groups.google.com/d/ optout > <https://groups.google.com/d/optout>. > > > > > -- -- 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] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
