many thanks . 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
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
'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
}
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?
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!
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
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!
I can’t solve my download problem.
I am using Katalon studio version 5.6.3 and
Chrome Version 68.0.3440.106 (Official Build) (64-bit).
I have same problem like @Girish Mohite
When i click on download button new window is opened.
I cant record anything with SPY WEB on that new window. That means i cant click on download button. That is why i tried to simulate CTRL + S, but since i cant record anything on that new windows i cant sendKeys to object.
So i used robot class.
When i simulate CTRL+S with robot class SAVE AS windows appears.
Is there anything i can do to to avoid SAVE AS dialog?
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
Thanks for the help.
Both Chrome and Firefox is working like a charm.
However, I was wondering if it is possible to make download path dynamic for both Firefox and Chrome as it is required to pass the absolute path which varies based on the OS.
I am unable to download file using Chrome browser, download window getting closed with out downloading the required file, could you please send me the code and the required setting for Chrome using Katalon studio.
* download CSV to specified
*/
@Keyword
public boolean isFileDownloaded(String downloadPath, String fileName) {
File dir = new File(downloadPath);
File[] dirContents = dir.listFiles();
String lastAttempt = "";
if (dirContents.length > 0) {
for (int i = 0; i < dirContents.length; i++) {
if (dirContents[i].getName().equals(fileName)) {
// File has been found, it can now be deleted:
dirContents[i].delete();
KeywordUtil.markPassed(fileName + ' exist in ' + downloadPath + ' and was deleted')
return true;
}
lastAttempt = dirContents[i].getName().equals(fileName);
}
if (lastAttempt != fileName) {
KeywordUtil.markFailed(fileName + 'does not exist in' + downloadPath)
return false;
}
}
return false;
}
}
then I invoked the keyword as follows in the test case:
WebUI.delay(2)
CustomKeywords.'com.company.katalon.cp.DataKeywords.isFileDownloaded'('C:\\Users', 'userlist.csv')```
this works in chrome with no issues. Hope this helps.
@marivic_e_lorilla thank you very much for this help! I inputted these into my desired capabilities, however, I am still not able to download files from chrome.