pywinauto automation worked relatively fast, but now is very slow with no changes to my script

I’m making a pywinauto program to automate tasks in a benchmarking program. It will not work with the ‘win32’ backend because it has some special control-types, thus I have stuck with ‘uia’. For the past few weeks, the program has worked somewhat fine with few pywinauto bugs. However, I have noticed that over time, starting the program over and over (due to debugging and the occasional error), it will suddenly slow down for about 1-2 minutes per operation until I restart my computer.

More specifically, when this happens, every pywinauto searching operation slows down significantly. For example, calling dialog.child_window() begins to take almost exactly 60 seconds each time it is called (with and without timeouts). I’ve read up on the ways to speed it up, such as control-type, class-name, and wrapper objects, but this has not changed the speed at all since I had already been doing this in my code. The application itself has <200 identifiers, so I don’t believe it’s a size issue either.

To re-iterate, this would only happen after I’ve been debugging the program for many hours and it failed to close the app after so many times. Restarting my computer has been a working solution up until now. As of recent, it is always slow per every search (child_window) operation, even after a restart. Before, the entire program would complete its automation in about 15-20 seconds. Now, it takes almost 15-20 minutes.

Finally, I am unsure whether it has to do with how I connect to the application, but I believe this may not be the cause of my problems as this same line worked fine a week ago.
myApp = Application(backend='uia', allow_magic_lookup=False).connect(title="Benchmark - GUI 1.2.1", timeout=45)
This line takes about 60 seconds to connect to my window, regardless of what the timeout time is. I have also tried starting the application, then connecting to it, with no difference in time. Subsequently, every line that has to find an identifier will take a similar amount of time.

This problem really has me stumped since it worked perfectly fine for the past few weeks, so sorry if this post is ramble-y haha. I’ve skimmed through a handful of the github posts, but I haven’t come across one that has a solution that has worked for me. One thing I did notice when reinstalled was the clear_comtypes_cache package giving a warning about its directory not being in PATH, but again I am unsure if this is the cause or at all related.

Here are the solutions I have tried:

  • adding specifics to child_window() such as control_type, title, top_level_only, etc
  • restarting my computer each time this occurs (doesn’t work anymore)
  • reverting windows updates to before this problem was prominent
  • similarly, checking for windows updates
  • reinstalling pywinauto
  • wrapper objects to hold objects used many times
  • buffering when the app starts and when it connects
  • attempting to automate a different application to see if it’s app specific
  • clearing caches

As stated, restarting my computer was a solution up until now. As of now, I have restarted my computer a handful of times and the problem still persists. Next, when it slows, using wrapper objects reduces the time to about 1 minute per operation. Every other attempt hasn’t gotten me anywhere.

I hope I have provided sufficient information about what I have tried and what my problem is. I will gladly provide more information as needed. Any input, suggestions, ways I could troubleshoot would greatly be appreciated. Thanks! 🙂

New contributor

jumpy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật