我有一个 python 脚本,它试图将文件从我的 PC 上传到 Web 应用程序。我通过 WebDriver 按浏览器中的特定上传按钮,然后打开一个 Win7 资源管理器窗口供我导航并选择要上传的所需文件。我怎么能用 pywinauto 操作这个窗口?
可选:这也可以在 linux 中完成(我想使用适当的库)?
这是我的示例代码:
wd.find_element_by_css_selector("img.editLecturesButtons.fromVideo").click()
#switch to the lightbox
wd.switch_to_frame(int("1"))
#hit upload
wd.find_element_by_xpath("//*[@id='fileUpload']").click()
#TODO
import os,pywinauto.application
file = os.path.normpath("C:\Users\me\Desktop\image.jpg")
....