I'm used to Selenium and the page object pattern. I'm now moving to an automation project for a Windows app, so I'm discovering Pywinauto.

I've be looking for good practices and was expecting something like a Python flavor the page object pattern, but didn't find anything.

Can anyone give me tips on this tool to organize my project structure?

Thanks in advance.


I am afraid there is no such thing as "Python flavoured Page Object pattern". The thing about software design patterns is that they are universal; they can be used in the same fashion in most available languages.

With that said, if you are looking for specific guidelines for Python, check out the Python PEP8 style guide (https://www.python.org/dev/peps/pep-0008/). I also suggest using a linter and auto-formatter of your preference to keep your code clean and organized.


It's useful to inherit your page class from Application. So manual implementation of page objects is easy in Python.

The analogue of automatic page object generation is in mid-term plans for pywinauto: see issue #511. More short term improvement is in queue for the next update release 0.6.6 in issue #613.

There is also useful pywinauto.actionlogger module to log every action to your own location. Custom logger can be implemented using allure plugin for pytest that can produce hierarchical HTML report for your test suite. Pytest is also good choice to organize your tests. Pywinauto is only automation tool.

Probably all you need to install is:

pip install pywinauto pytest allure-pytest

and two more commands for allure-pytest: https://pypi.org/project/allure-pytest/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.