# Download file from web to desktop using Chrome

**URL:** <https://forum.katalon.com/t/download-file-from-web-to-desktop-using-chrome/9826>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [March 20, 2018, 1:47pm UTC](https://forum.katalon.com/t/download-file-from-web-to-desktop-using-chrome/9826 "2018-03-20T13:47:38Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![crokatalontest](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@crokatalontest](https://forum.katalon.com/u/crokatalontest)\
**Post date:** [March 20, 2018, 1:47pm UTC](https://forum.katalon.com/t/download-file-from-web-to-desktop-using-chrome/9826/1 "2018-03-20T13:47:38Z")

</div>

Hi all,

I am new to Katalon Studio. I can’t figure out how to download PDF file from web to my Downloads folder in windows.  
When i click on download button, new chrome window is opened. In that window i have my pdf document. In top right corner there is this icon for file download. I wasn’t able to click on it, so i used sendKeys to simulate CTRL+S

WebUI.sendKeys(findTestObject(‘Page\_f’), Keys.chord(Keys.CONTROL, ‘s’))

![](https://s3.amazonaws.com/katalon-forum/editor/qk/qyhpzqpbtsh6.png "Image: https://s3.amazonaws.com/katalon-forum/editor/qk/qyhpzqpbtsh6.png")

That worked but now i have another problem.  
Windows explorer SAVE AS window pops up and i am not able to click on SAVE because this is windows native dialog.

![](https://s3.amazonaws.com/katalon-forum/editor/i8/c5yfj3v75xgs.png "Image: https://s3.amazonaws.com/katalon-forum/editor/i8/c5yfj3v75xgs.png")

How can i download pdf document?  
Can i somehow simulate key press on SAVE button in windows dialog?

[download.PNG](https://s3.amazonaws.com/katalon-forum/editor/qk/qyhpzqpbtsh6.png)

[download\_windows.PNG](https://s3.amazonaws.com/katalon-forum/editor/i8/c5yfj3v75xgs.png)

---

<div class="post-metadata">

**Author:** ![crokatalontest](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@crokatalontest](https://forum.katalon.com/u/crokatalontest)\
**Post date:** [March 20, 2018, 2:48pm UTC](https://forum.katalon.com/t/download-file-from-web-to-desktop-using-chrome/9826/2 "2018-03-20T14:48:50Z")

</div>

I was able to solve it. I imported two java classes.

import java.awt.Robot;

import java.awt.event.KeyEvent;

and wrote this

Robot r = new Robot();

r.keyPress(KeyEvent.VK\_ENTER);

r.keyRelease(KeyEvent.VK\_ENTER);

And now this is what i have in my code:

WebUI.sendKeys(findTestObject(‘Page\_f’), Keys.chord(Keys.CONTROL, ‘s’))

WebUI.delay(2)

Robot r = new Robot();

r.keyPress(KeyEvent.VK\_ENTER);

r.keyRelease(KeyEvent.VK\_ENTER);

Java Robot class is able to interact with windows native dialog.

---

<div class="post-metadata">

**Author:** ![Marivic\_E\_Lorilla](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marivic_e_lorilla/32/5692_2.png) [@Marivic\_E\_Lorilla](https://forum.katalon.com/u/Marivic_E_Lorilla)\
**Post date:** [March 23, 2018, 9:49am UTC](https://forum.katalon.com/t/download-file-from-web-to-desktop-using-chrome/9826/3 "2018-03-23T09:49:02Z")

</div>

See my comment in [http://forum.katalon.com/discussion/4662/download-files-from-web-ui-not-working](http://forum.katalon.com/discussion/4662/download-files-from-web-ui-not-working). You’ll no longer need robot.

---

<div class="post-metadata">

**Author:** ![Girish\_Mohite](https://avatars.discourse-cdn.com/v4/letter/g/45deac/32.png) [@Girish\_Mohite](https://forum.katalon.com/u/Girish_Mohite)\
**Post date:** [July 23, 2018, 10:43am UTC](https://forum.katalon.com/t/download-file-from-web-to-desktop-using-chrome/9826/4 "2018-07-23T10:43:09Z")

</div>

> Marivic E. Lorilla said:
> 
> See my comment in [Download files from web ui not working - Bugs Report - Katalon Community](http://forum.katalon.com/discussion/4662/download-files-from-web-ui-not-working). You’ll no longer need robot.

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!

Am i missing something???

![](https://s3.amazonaws.com/katalon-forum/editor/wl/fvpwb9ynn4k0.png "Image: https://s3.amazonaws.com/katalon-forum/editor/wl/fvpwb9ynn4k0.png")

![](https://s3.amazonaws.com/katalon-forum/editor/4j/5pjgr8tuflak.png "Image: https://s3.amazonaws.com/katalon-forum/editor/4j/5pjgr8tuflak.png")

[Untitled.png](https://s3.amazonaws.com/katalon-forum/editor/wl/fvpwb9ynn4k0.png)

[screen.png](https://s3.amazonaws.com/katalon-forum/editor/4j/5pjgr8tuflak.png)

---

<div class="post-metadata">

**Author:** ![Marek\_Melocik](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marek_melocik/32/371_2.png) [@Marek\_Melocik](https://forum.katalon.com/u/Marek_Melocik)\
**Post date:** [July 23, 2018, 10:56am UTC](https://forum.katalon.com/t/download-file-from-web-to-desktop-using-chrome/9826/5 "2018-07-23T10:56:04Z")

</div>

Hello, try to follow this post:

> **[Identifying Chrome download box](http://forum.katalon.com/discussion/comment/13052/#Comment_13052)**
>
> Hi, I am recording a test which involves downloading a file from a webpage in Chrome.

---

<div class="post-metadata">

**Author:** ![Girish\_Mohite](https://avatars.discourse-cdn.com/v4/letter/g/45deac/32.png) [@Girish\_Mohite](https://forum.katalon.com/u/Girish_Mohite)\
**Post date:** [July 25, 2018, 8:50am UTC](https://forum.katalon.com/t/download-file-from-web-to-desktop-using-chrome/9826/6 "2018-07-25T08:50:33Z")

</div>

> [Marek Melocik](https://forum.katalon.com/profile/18/Marek%20Melocik) said:
> 
> Hello, try to follow this post:
> 
> [Identifying Chrome download box - #2 by Marek\_Melocik - Archive - Katalon Community](http://forum.katalon.com/discussion/comment/13052/#Comment_13052)

Thanks Marek, not sure though how to use it…Can you share keyword for this?

---

<div class="post-metadata">

**Author:** ![Marek\_Melocik](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marek_melocik/32/371_2.png) [@Marek\_Melocik](https://forum.katalon.com/u/Marek_Melocik)\
**Post date:** [July 25, 2018, 11:21am UTC](https://forum.katalon.com/t/download-file-from-web-to-desktop-using-chrome/9826/7 "2018-07-25T11:21:56Z")

</div>

There is a keyword called CustomChromeDriver, which contains one method. Just copy/paste it to your project and use in your test case (sample test case code is also there).

---

<div class="post-metadata">

**Author:** ![Girish\_Mohite](https://avatars.discourse-cdn.com/v4/letter/g/45deac/32.png) [@Girish\_Mohite](https://forum.katalon.com/u/Girish_Mohite)\
**Post date:** [July 26, 2018, 5:06am UTC](https://forum.katalon.com/t/download-file-from-web-to-desktop-using-chrome/9826/8 "2018-07-26T05:06:03Z")

</div>

Thanks Marek, but in my case the download url is dynamic and it opens up in new chrome window…so how to make it work out in this case???

---

<div class="post-metadata">

**Author:** ![bohumirs](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@bohumirs](https://forum.katalon.com/u/bohumirs)\
**Post date:** [May 22, 2019, 6:58pm UTC](https://forum.katalon.com/t/download-file-from-web-to-desktop-using-chrome/9826/9 "2019-05-22T18:58:00Z")

</div>

> [@crokatalontest](#):
>
> Robot r = new Robot();
> 
> r.keyPress(KeyEvent.VK\_ENTER);
> 
> r.keyRelease(KeyEvent.VK\_ENTER);

Thanks man! This works!

---

<div class="post-metadata">

**Author:** ![gunjan\_rijhwani](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@gunjan\_rijhwani](https://forum.katalon.com/u/gunjan_rijhwani)\
**Post date:** [May 28, 2020, 9:46pm UTC](https://forum.katalon.com/t/download-file-from-web-to-desktop-using-chrome/9826/10 "2020-05-28T21:46:46Z")

</div>

What is the - “Page\_f”. I am trying to open the pdf page which opens in a new page and cannot get the locator of the download button.  
So how can i write the sendkeys statement?

WebUI.sendKeys(null, Keys.chord(Keys.CONTROL,‘s’))

What should I put in place of null?

---

<div class="post-metadata">

**Author:** ![albert.vu](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/albert.vu/32/20595_2.png) [@albert.vu](https://forum.katalon.com/u/albert.vu)\
**Post date:** [August 8, 2022, 7:32am UTC](https://forum.katalon.com/t/download-file-from-web-to-desktop-using-chrome/9826/11 "2022-08-08T07:32:02Z")

</div>


