1

I am using pywinauto to automate the process of uploading photo, I use Selenuim to click on a button that pops up a window box to select and upload photo. I use Swapy to get the code for setting up automation, but that codes gives an error of "int took too long to convert" I have tried multiple things but failed

I tried To get it using the class names, titles etc but all failed

from pywinauto.application import Application
app = Application().connect(title=u'Open', class_name='#32770')
window = app.Open
static = window.Static
static.ClickInput()
static.type_keys(Name_of_File)
button = window[u'&Open']
button.Click()

I am expecting it to input the name Of file in the windows dialouge box and then click on Open Button to start uploading.

but I get the following error:

   return bool(win32functions.IsWindowVisible(handle))
   ctypes.ArgumentError: argument 1: <class 'OverflowError'>: int too long 
   to convert
Tayyab Nasir
  • 139
  • 2
  • 10
  • Possible duplicate of [Selenium: Upload file in Google Chrome](https://stackoverflow.com/questions/9665021/selenium-upload-file-in-google-chrome) – Infern0 Dec 27 '18 at 09:26
  • @Infern0 I want it done through pywinauto, please check if you can help. – Tayyab Nasir Dec 27 '18 at 09:36
  • The same way you click the button with selenium, you can send the path of file you wish to upload. Follow the guide i have provided. – Infern0 Dec 27 '18 at 09:49
  • Which Python version? 2.7/3.x? 32-bit or 64-bit? – Vasily Ryabov Dec 27 '18 at 12:24
  • @VasilyRyabov Python 3.x and 64 bit – Tayyab Nasir Dec 27 '18 at 12:32
  • @VasilyRyabov I can See huge experience on your profile, Please Guide – Tayyab Nasir Dec 27 '18 at 13:40
  • It looks like a bug. Thanks for the report (+1 from me). I can suggest to try Python 32-bit so far. Anyway we're going to fix it in next update release 0.6.6 early next year. – Vasily Ryabov Dec 27 '18 at 22:08
  • The issue is tracked here: https://github.com/pywinauto/pywinauto/issues/641 – Vasily Ryabov Dec 27 '18 at 22:11
  • Yeah thanks, for now I have got it working by using multiple things in pywinauto, as I saw answers on your profile it helped. I am making it to try untill a string is written to the file name box and for OPEN key press I am using the enter key press in windows. Using pywinauto Keyboard library. – Tayyab Nasir Dec 28 '18 at 09:41

0 Answers0