当前环境:Win10 + Python3.7 + pywinauto==0.6.8,selenium==3.14.1
示例代码
python
from pywinauto import Desktop
import os
app = Desktop()
dialog = app['打开']
dialog['Edit'].set_edit_text(os.getcwd() + '.\\example-01.jpg')
dialog['Button'].click()
'''
其他方法:
from pywinauto import application
import os
app = application.Application()
app.connect(title='打开')
# app['Dialog']['Edit1'].type_keys(os.getcwd() + '.\\example-01.jpg')
# app['Dialog']['Edit1'].SetEditText(os.getcwd() + '.\\example-01.jpg')
app['Dialog']['Edit1'].set_edit_text(os.getcwd() + '.\\example-01.jpg')
app['Dialog']['Button1'].click()
'''
参考: