import time
from selenium import webdriver
driver=webdriver.Chrome()
driver.implicitly_wait(10)
driver.get('https://tinypng.com/')
# Trigger file selection box
driver.find_element_by_css_selector('#top > section > section > figure').click()
time.sleep(2)
# Import Windows Keyboard event library
import win32com.client
shell=win32com.client.Dispatch("WScript.Shell")
shell.SendKeys(r'C:\Users\Public\Pictures\Sample Pictures\222.jpg'+'\n')# Note the escape effect of carriage return
# Keyboard event simulation
import win32api
import win32con
# Simulate the down button
win32api.keybd_event(win32con.VK_DOWN,0)