Download files from web ui not working

hi !
to learn how to download files from web ui, i have downloaded the example scripts from https://www.katalon.com/resources-center/tutorials/handle-file-uploads/

i want to download the file into the default download directory.
so my project settings for firefox are as follows

browser.download.manager.showWhenStarting : Boolean : false

browser.helperApps.neverAsk.saveToDisk : String : text/csv,application/vnd.ms-excel,application/msexcel,application/x-msexcel,application/excel

browser.helperApps.neverAsk.openFile : String : text/csv,application/vnd.ms-excel,application/msexcel,application/x-msexcel,application/excel

But the the excel file (smilechart.xls) on Excel Templates [Free Download]
could only be downloaded after clicking the download button manually. it is still possible to choose between Open with “Microsoft Excel” or Save file. But this dialog should be suppressed with the settings above.
because this is very important for our solution, please let me know some hints how to solve this problem. many thanks

tom

i am using: Firefox 57, Katalon Studio 5.2.0 build 1, Win 7/64

1 Like

i will give you with the console output until the dialogbox appears…see attachment

console output until dialog box appears.txt

Can you show me how you use those settings in Project -> Settings?

Vinh Nguyen said:

Can you show me how you use those settings in Project → Settings?

here is the screenshot with the settings in Project > Settings:

projsettings.JPG

I’ve figured out you have to put these settings into ‘firefox_profile’ map, like this:

2018-01-14_210932.png

hi !

many thanks :smiley: . this works and this is my Dictionary.

But there are more questions:
**what should i do to test this also with Chrome, IE, Safari etc.?
**what are the names of the profiles ?
thanks for your support

tom

dict3.JPG

Hello,

This answer is great and worked for me also.
But I am also lobby-ing for other browser profile configurations: Chrome, IE, Safari, where possible.

Thank you,
Cornel Neacsu

Cornel Neacsu said:

Hello,

This answer is great and worked for me also.
But I am also lobby-ing for other browser profile configurations: Chrome, IE, Safari, where possible.

Thank you,
Cornel Neacsu

For Chrome: You should pass it like this: Download files in Chrome browser using selenium WebDriver - qavalidation

IE & Safari doesn’t provide automatic download, so you need to handle this by yourself using scripting I believe

Screen Shot 2018-01-23 at 09.47.46.png

1 Like

Unsure what I need to do in order to get the Chrome download go to into a specific folder? I see the link above, but unsure where to place this and how to pass a folder to download into. We only use Chrome for our testing at this time. What are the arg values for the above screenshot?

Thank you for any assistance.

Dave

1 Like

Can you please help how to handle download in Internet Explorer? As i got tomorrow last day to present in front of manager to get approval for Katalon in our company.
Need your Urgent help.

Dave Weil said:

Unsure what I need to do in order to get the Chrome download go to into a specific folder? I see the link above, but unsure where to place this and how to pass a folder to download into. We only use Chrome for our testing at this time. What are the arg values for the above screenshot?

Thank you for any assistance.

Dave

Hi,

This one is as well my problem before. And it took me weeks to solve. Got them solved (with God’s help). See below Desired Capabilities applied in Chrome execution settings:


prefs contains:
profile.default_content_settings.popups | Number | 0
download.default_directory | String | C:\Shared - you can change the path to your desired location

args contains:
String | --test-type
String | --disable-extensions

Hope this helps.

My problem now is how to set the filename accdg to my preference. That, i am still working on.

image.png

2 Likes

tom said:

hi !

many thanks :smiley: . this works and this is my Dictionary.

But there are more questions:
**what should i do to test this also with Chrome, IE, Safari etc.?
**what are the names of the profiles ?
thanks for your support

tom

Hi all,

I added application/pdf as Value for browser.helperApps.neverAsk.saveToFile but the dialog still pops up when the test click on the download icon.

Anyone encounter this as well?

Many thanks for any solution/suggestion given.

For me also, while downloading the pdf the dialog box gets opened up as the test clicks on the download icon.
Could you please help in downloading a pdf file

4 Likes

Eileen said:

tom said:

hi !

many thanks :smiley: . this works and this is my Dictionary.

But there are more questions:
**what should i do to test this also with Chrome, IE, Safari etc.?
**what are the names of the profiles ?
thanks for your support

tom

Hi all,

I added application/pdf as Value for browser.helperApps.neverAsk.saveToFile but the dialog still pops up when the test click on the download icon.

Anyone encounter this as well?

Many thanks for any solution/suggestion given.

In firefox_profile map, Add setting: pdfjs.disabled || True

1 Like

Marivic E. Lorilla said:

Dave Weil said:

Unsure what I need to do in order to get the Chrome download go to into a specific folder? I see the link above, but unsure where to place this and how to pass a folder to download into. We only use Chrome for our testing at this time. What are the arg values for the above screenshot?

Thank you for any assistance.

Dave

Hi,

This one is as well my problem before. And it took me weeks to solve. Got them solved (with God’s help). See below Desired Capabilities applied in Chrome execution settings:


prefs contains:
profile.default_content_settings.popups | Number | 0
download.default_directory | String | C:\Shared - you can change the path to your desired location

args contains:
String | --test-type
String | --disable-extensions

Hope this helps.

My problem now is how to set the filename accdg to my preference. That, i am still working on.

It does not work for me :frowning:

The following settings worked for me on

Google Chrome 66.0.3359.181


where perfs contains the following settings

Below is what my groovy script looks like


'Define Custom Path where file needs to be downloaded'
String downloadPath = 'C:\\temp'
'Wait for Some time so that file gets downloaded and Stored in user defined path'
WebUI.delay(10)
'Verifying the file is download in the User defined Path'
Assert.assertTrue(isFileDownloaded(downloadPath, '.csv'), 'Failed to download Expected document')
WebUI.closeBrowser() //Iterating a loop for number of files available in the folder to verify file name in the folder
boolean isFileDownloaded(String downloadPath, String fileName) {
    boolean flag = false
    'Creating an object for File and passing the download Path as argument'
    File dir = new File(downloadPath)
    'Creating an Array where it will store all the files from that folder'
    File[] dir_contents = dir.listFiles()
    for (int i = 0; i < dir_contents.length; i++) {
        println('File Name at 0 is : ' + dir_contents[i].getName())
        'Verifying the file name is available in the folder '
        if (dir_contents[i].getName().contains(fileName)) {
            'If the file is found then it will return a value as true'
            return flag = true
        }
    }
    
    'If the file is found then it will return a value as false'
    return flag
}

2018_05_26_03_09_59_Project_Settings.png

2018_05_26_03_10_53_Katalon_Studio_CommandCenterEnterpriseRegression_Location_C_Users_imran_K.png

3 Likes

In firefox_profile map , I have the next dictionary:
with pdfjs.disable true, the file didn’t download, but if i don’t write this preference the download file popup is opened. I am using an image button

The code in the script to download the file is:

if (true) {

WebUI.waitForElementClickable(findTestObject(‘Page_Servicio de Rentas Internas/img’), 2)

if (true) {

//Dar click sobre el icono pdf para descargar el archivo’

WebUI.click(findTestObject(‘Page_Servicio de Rentas Internas/img’))

//Esperar para que el archivos se descargue en el path definido por el usuario

WebUI.delay(10)

}

}

how can i download the file without to see the popup opened?

firefox_profile_dictionary.png

I am using similar settings for chrome, but unable to download, Do i also need some code in this case other than settings…In my case file is getting opened in another chrome window where i have to click on download button to save it to a particular folder…Please help!

Untitled.png

screen.png

Carlos Fontana said:

Marivic E. Lorilla said:

Dave Weil said:

Unsure what I need to do in order to get the Chrome download go to into a specific folder? I see the link above, but unsure where to place this and how to pass a folder to download into. We only use Chrome for our testing at this time. What are the arg values for the above screenshot?

Thank you for any assistance.

Dave

Hi,

This one is as well my problem before. And it took me weeks to solve. Got them solved (with God’s help). See below Desired Capabilities applied in Chrome execution settings:


prefs contains:
profile.default_content_settings.popups | Number | 0
download.default_directory | String | C:\Shared - you can change the path to your desired location

args contains:
String | --test-type
String | --disable-extensions

Hope this helps.

My problem now is how to set the filename accdg to my preference. That, i am still working on.

It does not work for me :frowning:

Did you insert step to click download button??
Here is the setting should exactly look like, if you find it hard to follow above instruction.

download.png

1 Like

Girish Mohite said:

I am using similar settings for chrome, but unable to download, Do i also need some code in this case other than settings…In my case file is getting opened in another chrome window where i have to click on download button to save it to a particular folder…Please help!

Try using sendkey - CONTROL + S :slight_smile: