import pyautogui
import os
import time
import pyperclip
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
driver.maximize_window()
driver.get(
"https://www.facebook.com")
driver.find_element_by_css_selector("body").send_keys(Keys.CONTROL+"a")
driver.find_element_by_css_selector("body").send_keys(Keys.CONTROL+"c")
os.system("start " + "test.docx")
time.sleep(5)
a = pyperclip.paste()
pyautogui.typewrite(a)
time.sleep(5)
you can use pyperclip to get the clipboard content , os to open a text.docx and pyautogui to paste it
Note: make sure you have a file called test.docx in current directory
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…