How to create a python behave page object model project

655 points
python behave page object model
python behave page object model

Python Behave Page Object Model project

We already disacussed how to get started with python behave here , but let’s go a little bit further and see how python behave page object model projects looks like .

Just to recap what is page object model :

Page Object Model is an Object Repository design pattern in Selenium WebDriver. POM creates our testing code maintainable, reusable. Page Factory is an optimized way to create object repository in POM concept.

I’m not gonna go in so much details about it , this is just a standard definition but I’ve already discussed page object model for a java seleniumn project here , also there was a discussion about design patters in testing   also c# selenium page object model project is here and ruby watir page obejct model is here.

This are just some links if you are interested in other programming languages rather than python and you can inspire yourslef and refine your project or maybe you can share your suggestions in the comments section bellow.

What is behave?

behave is behaviour-driven development, Python style. , you can read the entire philosophy here.

Python behave page object model project structure

├── behave.ini
├── build.xml
├── failed_scenarios_screenshots
│   └── Login\ and\ click\ summer\ dresses_failed.png
├── features
│   ├── TermsSearch.feature
│   ├──
│   ├── __init__.pyc
│   ├──
│   ├── lib
│   │   ├──
│   │   ├── __init__.pyc
│   │   ├──
│   │   ├── pagefactory.pyc
│   │   └── pages
│   │   ├──
│   │   ├── __init__.pyc
│   │   ├──
│   │   ├── base_page_object.pyc
│   │   └──
│   └── steps
│   └──
├── requirements.text
├── results.json
├── seleniumframework_tests.log

I’m not gonna go in details why we need page factory , why bdd , why and why , you can check my previous articles to understand more and you can clone the project from our github page here.

Happy testing!

Like it? Share with your friends!

655 points
Test engineer


Your email address will not be published. Required fields are marked *

ten − six =