How do I automatically download files from a pop up dialog using selenium-python

后端 未结 10 1331
死守一世寂寞
死守一世寂寞 2020-12-16 13:19

I am trying to automatically download files from a pop up dialog using selenium-python.

The firefox popups look like this

10条回答
  •  有刺的猬
    2020-12-16 14:02

    With my using and test in my Selenium UI automation test, configuring the Firefox Profile is more stable than Robot Class. E.g. Disable popping up the System non-webpage Download/Save Dialog.

    FirefoxProfile prof = new FirefoxProfile();
    
    ffprofile.setPreference("browser.download.panel.shown", false);
    ffprofile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/zip");
    
    //ffprofile.setPreference("browser.download.folderList", 1);  // Default to /home/user/Downloads in Linux.
    ffprofile.setPreference("browser.download.folderList", 2); 
    ffprofile.setPreference("browser.download.dir", "/tmp");
    

提交回复
热议问题