I was able to successfully download files with the below code [your code 
seems fine too]. Can you post the url which you are trying? maybe its not 
the code, but some other environment issue ?

Cheers

On Wednesday, January 14, 2015 at 9:52:43 AM UTC-5, Selenium Framework 
wrote:
>
> Here is an example of automatically downloading files in firefox (Navigate 
> to section "Automatically download without file dialog")
> http://www.seleniumframework.com/intermediate-tutorial/firefox-profile/
>
> Cheers!
>
> On Tuesday, January 13, 2015 at 3:14:21 PM UTC-5, Joe Fl wrote:
>>
>> So, I tried the example for firefox and i am still getting the dialog 
>> save window for our app.
>>
>> I am attempting to download an excel file.  I enter the page click a 
>> button 'Show Download Link' then an 'Accept' button and lastly the link to 
>> download the file.  At this point the save dialog window opens...  Honestly 
>> I am only changing one thing from the example.
>>
>> profile = Selenium::WebDriver::FireFox::Profile.new
>> profile['browser.download.dir'] = "/tmp/webdriver-downloads"
>> profile['browser.download.folderList'] = 2
>> profile['browser.helperApps.neverAsk.saveToDisk'] = "application/pdf"
>>
>> @browser = Watir::Browser.new :firefox, :profile => profile
>>
>> I did notice the chrome explanation had a full list of profile options, 
>> is there one for firefox?
>>
>> Titus, Dan, and anyone else have you been able to successfully prevent 
>> this dialog window from opening using this method?
>>
>> Joe
>>
>>
>> On Mon, Jan 5, 2015 at 2:58 PM, Titus Fortner <[email protected]> 
>> wrote:
>>
>>> The problem with save as dialogs is that they are a part of the 
>>> operating system,  not the browser. What you can do is set the browser 
>>> profile to not check with the os when downloading. 
>>>
>>> Using profiles with watir - 
>>> http://watirwebdriver.com/firefox/
>>> http://watirwebdriver.com/chrome/
>>>
>>> Titus 
>>> On Jan 5, 2015 2:53 AM, "Dan Sharp" <[email protected]> wrote:
>>>
>>>> Hi!
>>>>
>>>> I'm new to Watir... working on a script to automate some browser screen 
>>>> scraping.
>>>>
>>>> One page in particular has this problem that I'm stuck on:  the page 
>>>> has a link that is a javascript link, and the result of the javascript is 
>>>> that it generates/sends a PDF to be downloaded/saved.  So when I use Watir 
>>>> to click the link, I get the Save As dialog, but I have no idea how to 
>>>> make 
>>>> it actually click the "OK" button in the Save As dialog. It's not a 
>>>> javascript window, so the usual javascript dialog/alert methods don't 
>>>> work.  Also, as the link is not a direct link to the PDF, I can't 
>>>> right-click on it to save it without the dialog.
>>>>
>>>> I tried looking through the source to see if the URL was just hidden, 
>>>> but it's not... it appears to be generated via some convoluted javascript.
>>>>
>>>> So I'm stuck. I can manually click the link and get the Save As dialog 
>>>> and manually click the "OK" button (I'm on a mac, using Firefox, if the 
>>>> matters).  But I can't automate it.
>>>>
>>>> Any help?
>>>>
>>>> Thanks!
>>>>
>>>> -Dan
>>>>
>>>> -- 
>>>> -- 
>>>> 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.
>>>>
>>>  -- 
>>> -- 
>>> 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.
>>>
>>
>>

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

Reply via email to