Rafique, clearly explains every concept and shows that he has good knowledge on the subject. Keep making such helpful videos. May be another video about working with different controls with Pywinauto would be very helpful.Thanks again.
This is really helpful 👍 but can you explain why did you used handle for browse last. Detail description or explanation of functions could help us to understand code .
Hi Bro! Some times application takes more time to load. So those cases how can we handle? Example:- I am having one application it will take more time to load as normal at that time static time will won't helps me so i need to create dynamic time based on some other element came how can we do? Thanks in advance
Hi, Sorry for the delayed response. You can try the below after your start application app.windowtitle.wait('enabled', timeout=10) It will wait till 10 sec and then throw exception. You can increase the timeout to 20-25s. Regards, Rafique
Hi Rafique, First of all, nice tutorial. Thanks for that. I tried the ways shown in the video to automate appium-desktop windows application but not able to do. When I print app.windows(), it is showing an empty array. Can u help me in this ?
Hello Rafique, this video was informative but could you please help me with different use case where I want the list of files which are active in a windows explorer...active files means the files which we select using ctrl+ right click
Brother this video really awesome I am just beginner for python but easy to understand, I have one click once winform do you have any video to automate .Net based winform application like handle multiple window, combobox, menus
Hello rafique, explanation was too good can you please the command we use to exit the application automatically like for example to exit the fileZilla server automatically in this video scenario
Hi, You can use pywinauto mouse for doing this. Get the center coordinates of the window of the application, pywinauto.mouse.scroll(coords=(0, 0), wheel_dist=1) # for scroll up , wheel_dist=1, for scroll down, its in negative, you can increase or decrease the wheel_dist based on your requirement. and coords should be center coords of the window. Thanks
Its really very good video. Thank you. I have a question. I have Windows GUI where I want to read data what is available in textfields and all items in combobox or dropdown box. May I know how this can be achieved using PyWinAuto?.
Hi Masthanvali, I have created on a video on your requirement. Below is the link of the same, ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Y8ZO3I55lTc.html Please let me know if any issues. Thanks, Rafique
Hi, I have created a video on the same,, ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Y8ZO3I55lTc.html Hope this satisfies your requirement. Please do let me know about it. Regards, RAFIQUE
Hi This is very helps to me. In this video you are going with title of window. But in my application there is title less windows. such situation how we can enter the value inside that window.
Excellent work bro your video helped me a lot in starting my project. Bro will this library work in linux ? If not suggest any alternatives of this library in linux . Thanks in advance
It will work in linux but only keyboarrd and mouse functionalities will work. I havee lots of videos created with pywinauto.you can go through those. Regards, Rafique
Pywinauto is developed for automating Windows GUI application, But yes you can use pywinauto mouse and keyboard controls for automating Linux applications.
thanks for sharing the video..Can you please help when i try launching an setup.exe i am getting this error (requested operation requires elevation ) how to resolve this
Hi, You can try the below, import admin if not admin.isUserAdmin(): admin.runAsAdmin() or create a batch file and put the python script path in it and run the batch file as administrator.
Hi Ashish, It varies from app to app. Its better to use Inspect tool or print_control_identifiers() to fetch the class name/control name of each object Regards, RAFIQUE
Hi, You can use the PID to connect to an open window. import psutil process_name = "EXCEL" # your application process name from Task manager pid = None for proc in psutil.process_iter(): if process_name in proc.name(): pid = proc.pid print(pid)
Hey Rafique, I am getting an error while importing pywinuato. Import win32ui Import error : dll load failed while importing win32ui : a dynamic link library (DLL) initialization routine failed
Hi, If you want to store string in unicode type you can put u in front of the text like u'text' or you can do this by calling unicode('text') You can ignore "u". It is used in python 2.x Why we use r? You cannot store one backslash by using r, it's the only exception. So this code will produce error: r'\' To store a backslash (only one) you need to use '\\' If you want to store more than 1 characters you can still use r like r'\\' will produce 2 backslashes as you expected. Hope you are clear about u and r.. Regards, Rafique
HI Rafique, i liked ur tutorial but i am not able to click ok on windows security while doing RDP. i have reached till entering password but no luck to click OK button.
Hi Himanshu, I believe, you need to lower down the UAC security, because, pywinauto will not be able to find the windows security window. Regards, Rafique
Hi Himanshu, Did you try this, app.windowtitle.Button.OK.click() or app.windowtitle.OKButton.click() If still not, Then write the below line after the password script. send_keys("{ENTER}") you need to import the below line first from pywinauto.keyboard import send_keys
Hi, You can use nmap to get the OS name via python. first get the list of active IPs in the network via nmap network scanning and then get the hostnames os OS details for those active IPs. Thanks
Hi! great tut Great video! Can you help me, I'm a beginner. I have the following error. Can you help me troubleshoot this? " ImportError: DLL load failed while importing win32ui: A dynamic link library (DLL) initialization routine failed. " Info: Windows 10 (64bit) py3.9, PycharmCE2020.
Hi Rob, Did you install pypiwin32 or pywin32 library? If you have installed pypiwin32 then uninstall it and install pywin32. Let me know if this helps, Regards Rafique
@@rafiquejaved1223 . Thanks for the video. I am also using the same settings as Rob. (Windows 10 (64bit) py3.9, PycharmCE2020.) and getting the same error " ImportError: DLL load failed while importing win32ui: A dynamic link library (DLL) initialization routine failed. ". I've not installed pypiwin32. Please suggest on how to resolve this issue. Thanks
Hi, I will try to recreate the issue and get back to u with solution. Most probably its an environment related issue. Also did you try running the same script using python IDE. Regards, Rafique
Hi Harsh, Pywinauto is developed for automating Windows GUI application, But yes you can use pywinauto mouse and keyboard controls for automating Linux applications. But i have never tried doing this. Thanks, Rafique
Hi, I will not suggest to automate WebUi application using Pywinauto. You can use Pywinauto but mostly you will be required to use Mose and keyboard controls for automation. Rather you can use python robot framework for doing the same. I have videos on this. You can have a look. Still i will make a video on Chrome using pywinauto and will publish it. Regards, Rafique
@@rafiquejaved1223 I have checked that ("python robot framework") but, there might a confusion. I am not looking for a website or webpages automation on chrome. I am looking for chrome automation like opening/closing new tabs, changing some chrome settings In that way I want to control the chrome browser, not the webpage/website opened in chrome. I have no interest in the automation of webpages.
Hi Ravi, Can you please elaborate more on what you want to achieve? Is it something you are looking to open notepad with filename "102.txt"? Regards, Rafique
Hi, I have written a small code for the same, if you looking for standalone login window and type the credentials in the text box then the below command should work for you # find the open window with the titlename w_handle=pywinauto.findwindows.find_windows(title=u'yourwindowtitlename')[0] # if your title is big you can best_match instead of title window=app.window(handle=w_handle) window.wait('ready',timeout=3) #using inspect tool you can find the object name for the entrybox window[u'username:Edit'].type_keys("Your username") window[u'Password:Edit'].type_keys("Your password") window.Ok.click() # Hope this works, if not, please mail me at rafiquejaved2@gmail.com with your requirement. # There is one more video available, that may help you with automating Desktop applications, ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-ekqxkUExvlc.html.
@@rafiquejaved1223 Respected Sir, Please let me know,if I have made exe file from .py file through Pyinstaller then this exe file can be automated or not? What I have noticed sir,If we install the software on windows then this works Only
Hi Ashish, Yes this exe file can very well automate your task even is Windows which don't have python interpreter installed. If you need to go through py.exe conversion you can refer the below video. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-qihNyu7hoO0.html Also if you don't want any console to be opened during execution of exe file, you can use the below command, which i haven't mentioned in the video, pyinstaller --onefile --noconsole your.pyfile.py Regards
@@rafiquejaved1223 Dear Sir,Suppose I have created an exe file from .py file and I kept it on desktop. And also in this .exe file there are three three things ..first name,last name with the text boxes and one command button with ok label. Now I have to automate it. I mean pls help me to write full python command at first to execute that desktop python exe file and after that they will type user first name and last name in two different text boxes and then do click on ok. Regards
Hi Rafique, getting following error, can you please help out. error Traceback (most recent call last) File ~\Anaconda3\lib\site-packages\pywinauto\application.py:1038, in Application.start(self, cmd_line, timeout, retry_interval, create_new_console, wait_for_idle, work_dir) 1037 try: -> 1038 (h_process, _, dw_process_id, _) = win32process.CreateProcess( 1039 None, # module name 1040 command_line, # command line 1041 None, # Process handle not inheritable. 1042 None, # Thread handle not inheritable. 1043 0, # Set handle inheritance to FALSE. 1044 dw_creation_flags, # Creation flags. 1045 None, # Use parent's environment block. 1046 work_dir, # If None - use parent's starting directory. 1047 start_info) # STARTUPINFO structure. 1048 except Exception as exc: 1049 # if it failed for some reason error: (2, 'CreateProcess', 'The system cannot find the file specified.') During handling of the above exception, another exception occurred: AppStartError Traceback (most recent call last) Input In [20], in () ----> 1 app = Application().start(cmd_line = u'"C:\Program Files\Microsoft Office oot\Office16\WINPROJ.EXE"') File ~\Anaconda3\lib\site-packages\pywinauto\application.py:1052, in Application.start(self, cmd_line, timeout, retry_interval, create_new_console, wait_for_idle, work_dir) 1048 except Exception as exc: 1049 # if it failed for some reason 1050 message = ('Could not create the process "%s" ' 1051 'Error returned by CreateProcess: %s') % (cmd_line, str(exc)) -> 1052 raise AppStartError(message) 1054 self.process = dw_process_id 1056 if self.backend.name == 'win32': oot\Office16\WINPROJ.EXE""Could not create the process ""C:\Program Files\Microsoft Office Error returned by CreateProcess: (2, 'CreateProcess', 'The system cannot find the file specified.')