1

Seems download dialog-box is not a DOM , thus

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

dr = webdriver.Ie(executable_path="IE.exe")

# EXAMPLE  -- download ZIP Jun 20,2018
dr.get('https://usda.library.cornell.edu/concern/publications/j098zb09z?locale=en')
download_CSV =driver.dr.dr.find_element_by_css_selector('#j6731631h > div').click()

# Find the download dialog-box and click save but no function in python selenium.

How to apply these function in python through what kind of library ?

using System.Windows.Forms;

SendKeys.SendWait(@"C:\Users\Public\Pictures\Sample Pictures\Dock.jpg");
SendKeys.SendWait(@"{Enter}");

Explanation from CheryJose clearly tell dialog-box is not one of the DOM

Selenium Web Driver Cancelling Firefox Downloads

How to combine with those script in Python ? to control the download dialog-box -- these dir & click OK

rane
  • 901
  • 4
  • 12
  • 24

1 Answers1

2

Please refer to this thread, you could use the send_keys method and Keys.ENTER:

from selenium.webdriver.common.keys import Keys
driver.find_element_by_id("element_id").send_keys(Keys.ENTER)

Here are some related articles, you could refer to them:

Python selenium.webdriver.common.keys.Keys.ENTER() Examples

ENTER key press using Selenium WebDriver with python

Zhi Lv
  • 18,845
  • 1
  • 19
  • 30
  • Sorry , Zhi , thanks for your answer but , what is the method to control the pop-up dialog-box in IE to choose where to save and click save ? – rane May 23 '19 at 06:38
  • [link]https://doccenter.freedomscientific.com/doccenter/doccenter/rs25c51746a0cc/2012-04-25_internetexplorer9/02_internetexplorer9.htm -- go to part : JAWS 13.0.852 64-bit , the image show the dialog-box i have to take control – rane May 23 '19 at 06:40
  • 2
    As far as I know, WebDriver has no capability to access the IE Download dialog boxes presented by browsers when you click on a download link or button. But, we can bypass these dialog boxes using a separate program called "[wget](https://eternallybored.org/misc/wget/)". More details, you could check [this article](https://www.guru99.com/upload-download-file-selenium-webdriver.html). – Zhi Lv May 27 '19 at 12:23