xiaobei_selenium_automation/common/file_upload.py

32 lines
835 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
-------------------------------------------------
File Name
Description :
Author : xiaobei
CreateDate
wechatxiaobei_upup
-------------------------------------------------
"""
import os
import time
from pywinauto import Desktop
def upload_files(file_path, *args):
"""
:param file_path: files path which geometry files in directory
:param args: file name about geometry files
"""
app = Desktop()
# select the explorer file popover
shon = app["Select Geometry Files"]
# accept the one or more files to write into input box
for i in args:
send_keys('"{}"'.format(i))
url_tab = shon["Toolbar3"]
url_tab.click()
# input url of the geometry files
send_keys(file_path)
send_keys("{VK_RETURN}")
time.sleep(1)
shon["打开(O)"].click_input()