Test Automation Framework (Selenium with Java) — Daddy Issues or Page Factory and Elements Related Exceptions

Tomasz Buga
8 min readOct 30, 2021

S01E05 of the Test Automation Framework series about everything you’ll need to set up the nice, simple, yet sophisticated framework.

Covered with clear explanations and pretty illustrations.

Sounds like fun? Cool. Now, please, fasten your seatbelts because you’re here for a ride.

S01E01 — What To Automate?

S01E02 — Test Automation Environment and Tools

S01E03 — The First Selenium Test Case

S01E04 — Selenium Foundations Revisited

S01E06 — Page Loading Strategies and Waits

S01E07 — Translating JIRA with Selenide (with Exercises)

S01E08 — JIRA, Selenide, Complex SQL, Java Objects with Equals & HashCode (with Exercises)

S01E09 — Code Review and Refactoring (Part 1)

S01E10 — Code Review and Refactoring (Part 2)

S01E11 — Allure in Action

After I posted the fourth episode of Test Automation Framework on the r/QualityAssurance subreddit, user romulusnr has raised a concern:

Oh. You’re using PageFactory. Oh dear. I’m sorry. I’m so, so sorry.

Which got me thinking: “what’s this about?”. After a while, I’ve found the StackOverflow thread where people were talking about Selenium’s implementation of the PageFactory.

JeffC wrote:

Here’s Simon Stewart, Selenium project lead and creator of the Page Factory, at the 2017 SeleniumConf in Austin. During his keynote address he says not to use Page Factory. This section of the talk starts here:

https://youtu.be/gyfUpOysIF8?t=1517

Actual statement is at 27:25.

I watched the video, and I recommend it, but there wasn’t anything regarding why using the PageFactory is a bad idea. I mean, like a real-world example.

--

--

Tomasz Buga

Software Development Engineer in Tests. Passionate about programming. Experienced, former employee of the insurance industry. Graphic designer by choice.