8 reasons Page-Object Model is overrated

What is Page-Object model?

The theory

  • Single responsibility — a class should have a responsibility over a single part of the program that it should encapsulate,
    Or in the words of Robert.C Martin (AKA: uncle Bob), “there should never be more than one reason for change”.
  • Open-close — classes are open to extension (by inheritance) and close to modifications
  • Liskov substitution — If A subclasses B then A can replace B without warnings.
  • Interface segregation — in short, you should chop your interfaces to small unit such that no client is forced to be dependent on methods that it doesn’t use
  • Dependency Inversion — classes are dependent on abstractions and not on concrete implementations.

Lets see an example:

The benefits

  • Easy maintenance.
  • Tests scripts are more readable
  • Reusability
  • Modularization

The pitfall

Cost #1 — ITS NOT A CLASS!

class LoginPage(Page):
def __init__(self, drv):
self._username_locator: Tuple[By, str] = (By.ID, "txtUsername")
self._password_locator: Tuple[By, str] = (By.ID, "txtPassword")
self._login_btn_locator: Tuple[By, str] = (By.ID, "btnLogin")
def insert_username(self, username: str, timeout: int = 10) -> None:
username_element = WebDriverWait(self._driver,
def insert_password(self, password: str, timeout: int = 10) -> None:
username_element = WebDriverWait(self._driver,
def click_login(self, timeout: int = 10) -> HomePage:
username_element = WebDriverWait(self._driver,
hp = HomePage(self._driver)
return hp

Cost #2 — it doesn’t make any sense!

def test_case(self):
login_page: LoginPage = LoginPage(self._driver)
home_page: HomePage = login_page.click_login()
self.assertAlmostEqual(home_page.welcome_message, "Welcome Paul")

Cost #3 —It is not as readable as you think

Cost #4 — shared elements?

  • Inheritance — object share behaviors and fields from their parent classes.
  • Composition — objects hold a reference to the object containing the shared behaviors

Cost #5 — Its speculative

Cost #6 — You start asking silly questions

Cost #7— The kingdom of nouns

Cost #8 — paralysis by analysis





Automation and RPA developer, python developer.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Map a JSON File to Enum in Java

Best Practices for Instagram-style Feeds

Lesson 9: Preferences and settings

Misunderstanding Web App Development — Faster Delivery or Quality

Measuring progress and estimating time remaining of long running tasks in Go

Tableau External Services API: Haskell Expressions as Calculations

Vector 2 Mod Apk 1.2.1 Unlimited Everything 2022

Secondly, when these patients with COVID-19 crash, they crash very quickly and crash very hard

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Eldad Uzman

Eldad Uzman

Automation and RPA developer, python developer.

More from Medium


Hadoop Installation on Windows WSL 2 on Ubuntu 20.04 LTS (Single Node)

Python module not found — Ultimate guide

Converting CSV to Database