How to save IE as an attachment in python

When python uses selenium to download attachments, chrome and filefox can customize the download folder path, but IE cannot.
This is quite troublesome during automation. Many methods have been introduced on the Internet, which are quite troublesome.
The personal solution is as follows:

 # IE save as path
 def saveIeFile(self, filePath):
  win32api.keybd_event(117,0,0,0)  # F6
  win32api.keybd_event(117,0, win32con.KEYEVENTF_KEYUP,0)  # F6
  time.sleep(0.5)
  win32api.keybd_event(9,0,0,0)  # TAB
  win32api.keybd_event(9,0, win32con.KEYEVENTF_KEYUP,0)  #Release button
  time.sleep(0.5)
  win32api.keybd_event(40,0,0,0)  # DOWN
  win32api.keybd_event(40,0, win32con.KEYEVENTF_KEYUP,0)  #Release button
  time.sleep(0.5)
  win32api.keybd_event(65,0,0,0)  # A
  win32api.keybd_event(65,0, win32con.KEYEVENTF_KEYUP,0)  # A
  time.sleep(0.5)
  autoit.control_set_text("Save as","Edit1", filePath)
  time.sleep(1)
  autoit.control_click("Save as","Button2")

This method is operated by keyboard and automatically saved as the relevant file path

Recommended Posts

How to save IE as an attachment in python
How to save text files in python
How to wrap in python code
How to save the python program
How to omit parentheses in Python
How to filter numbers in python
How to read Excel in Python
How to view errors in python
How to write return in python
How to understand variables in Python
How to clear variables in python
How to use SQLite in Python
How to delete cache files in python
How to introduce third-party modules in Python
How to represent null values in python
How to write win programs in python
How to run id function in python
How to install third-party modules in Python
How to custom catch errors in python
How to write try statement in python
How to define private attributes in Python
How to add custom modules in Python
How to understand global variables in Python
How to view installed modules in python
How to open python in different systems
How to sort a dictionary in python
How to add background music in python
How to represent relative path in python
How to use the round function in python
How to use the zip function in Python
How to program based on interfaces in Python
How to install python in ubuntu server environment
How to simulate gravity in a Python game
An article to understand the yield in Python
How to use the format function in python
How to use code running assistant in python
How to set code auto prompt in python
Teach you how to write games in python
How to delete files and directories in python
How to install the downloaded module in python
How to write a confession program in python
How to perform continuous multiplication calculation in python
How to understand the introduction of packages in Python
How to understand a list of numbers in python
Example of how to automatically download pictures in python
How to create a Python virtual environment in Ubuntu 14.04
How to learn python quickly
How to uninstall python plugin
How to understand python objects
How to use python tuples
How to find the area of a circle in python
Do you still know how to draw cakes in python? ? ?
How to install Helm in Ubuntu
How to use hanlp in ubuntu
How to use python thread pool
How to write python configuration file
How to install mysql in Ubuntu 14.04
How to install Python 3.8 on CentOS 8
How to install Python 3.8 on Ubuntu 18.04
How to install Python on CentOS 8
How to install HDP2.6 in Centos7.2