A case against Page Object Model — part2

  1. Give a reply to some of the critics to the previous article
  2. Provide an alternative to Page Object Model
  3. Give a concrete example

1: Reply to critics

You picked a simple example.

You picked a dynamically typed language

  1. This is not true, python (similarly to most dynamically typed languages) has a static type checker.
    So the alleged benefit can be achieved in both cases.
  2. I still think that constraining the test script coder in such ways makes no sense.
    Because more often than not, there will come a moment when the constraint doesn’t fit the test case, and now the test coder is reluctant to find work arounds to the imposed barrier.
    Imposing limitations that don’t fit the test case not only take longer to conceptualize and develop (analysis paralysis), but they lead to inconsistent code that is more difficult to understand.

PageFactory and Screenplay

  1. It eases on the writing of the page object model.
  2. It provides (at least in java language) out of the box solutions to various problems, for example, stale element exceptions are avoided by “pinging” the element again and again before it’s operated on.

Page Object is great if done correctly

2: What’s the alternative?

3: Example

Recap:

re-write into procedural style:

Conclusion

I’ve got some more cool articles!

  1. Browser automation with robotframework
  2. Structural vs Nominal subtyping in python

--

--

--

Automation and RPA developer, python developer.

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

Recommended from Medium

Microservices the Agile Buzz

Vault-agent-injector fetches secret twice when using dynamic secret with environment variable on…

Nax CTF — TryHackMe

A Beginner’s Guide to Static Libraries in C

hello world

ångstromCTF Califrobnication writeup

Continuous Integration. CircleCI vs Travis CI vs Jenkins

DevOps tools to become expert in DevOps.

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

Continuous Integration of Github Releases with Jenkins

Introduction to Jib

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

Integrating Spring backend with Nexus server used as Maven and Docker repository