Skip to content Skip to sidebar Skip to footer

Upload A File Using Webdriver & Pywinauto

I have a python script that tries to upload a file from my PC to a web application. I press via WebDriver the specific upload button in the browser and then a Win7 explorer window

Solution 1:

I agree with Mark, you should try the Webdriver methods. Regard to pywinauto, code may looks like:

import pywinauto

pwa_app = pywinauto.application.Application()
w_handle = pywinauto.findwindows.find_windows(title=u'Open', class_name='#32770')[0]
window = pwa_app.window_(handle=w_handle)
ctrl = window['Name']
ctrl.SetText(file)
ctrl = window['OK']
ctrl.Click()

This sollution only for Windows, since pywinauto uses win32 api.

Post a Comment for "Upload A File Using Webdriver & Pywinauto"