How to dismiss Download dialog of Chrome with Selenium (by clicking Cancel) How to dismiss Download dialog of Chrome with Selenium (by clicking Cancel) google-chrome google-chrome

How to dismiss Download dialog of Chrome with Selenium (by clicking Cancel)


To enable or to prompt the browser to ask the permission can be done by using below code,

chromePrefs.put("download.prompt_for_download", false);

I can see that you have used it. Make it to true.

chromePrefs.put("download.prompt_for_download", true);

This will ask you to select the location for download. Since after clicking the download, in most cases the system window will open up and this cannot be handled using webdriver. For this you have to make use of third party tools like Sikuli.

More information for Sikuli can be found here.

I have not used Sikuli , but when I referred about your question. I saw the example given in the above link. May be that will help you.