# Cyprees - how to use page objects?

**URL:** <https://club.ministryoftesting.com/t/cyprees-how-to-use-page-objects/75841>\
**Category:** Discussions\
**Tags:** automation, cypress\
**Created:** [15 April 2024 11:56 UTC](https://club.ministryoftesting.com/t/cyprees-how-to-use-page-objects/75841 "2024-04-15T11:56:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lukdur](https://avatars.discourse-cdn.com/v4/letter/l/96bed5/32.png) [@lukdur](https://club.ministryoftesting.com/u/lukdur)\
**Post date:** [15 April 2024 11:56 UTC](https://club.ministryoftesting.com/t/cyprees-how-to-use-page-objects/75841/1 "2024-04-15T11:56:17Z")

</div>

I have a question in my project, like what is the good practice for page objects in case of - method of creating a new object, instead of using `static`?

---

<div class="post-metadata">

**Author:** ![ipstefan](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/ipstefan/32/8279_2.png) [@ipstefan](https://club.ministryoftesting.com/u/ipstefan)\
**Post date:** [16 April 2024 08:21 UTC](https://club.ministryoftesting.com/t/cyprees-how-to-use-page-objects/75841/2 "2024-04-16T08:21:26Z")

</div>

Hi,  
Can you develop the question and add a piece of code where you have an issue?

Cypress documentation refers to two pieces of info regarding POM:

- [Cypress: Page Object Examples](https://blerdeyeview.com/cypress-page-objects/)
- [cypress-example-recipes/examples/blogs\_\_application-actions at master · cypress-io/cypress-example-recipes · GitHub](https://github.com/cypress-io/cypress-example-recipes/tree/master/examples/blogs__application-actions)

---

<div class="post-metadata">

**Author:** ![conrad.braam](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/conrad.braam/32/660_2.png) [@conrad.braam](https://club.ministryoftesting.com/u/conrad.braam)\
**Post date:** [16 April 2024 09:02 UTC](https://club.ministryoftesting.com/t/cyprees-how-to-use-page-objects/75841/3 "2024-04-16T09:02:15Z")

</div>

Hi @lukdur , welcome to the MOT community.  
I have not used Cypress myself, and your question seems to indicate you need to learn about factory pattern as well still, because the generic factory-pattern will partialy answer that question I suspect, but it is fairly advanced to start.  
But there are some MOT threads about the pageobject problem-space.

> [@Migrating Test Suites From Selenium To Cypress?](https://club.ministryoftesting.com/t/migrating-test-suites-from-selenium-to-cypress/41232):
>
> In our Slack Ask Me Anything with @marie.drake and Filip Hric, @ziad_tawfeek asked Have you tried to migrate test suites from a Selenium-based framework to Cypress? How easy it is to do so, any insights also on obstacles faced on that road? @jainkat responded with The code organization is pretty different. Selenium test suites are usually organized into the Page-Object Model, and Cypress warns against using that. Conditional waiting and such is very different, too. I think you’d probabl…

> [@Selenium Page Object Model](https://club.ministryoftesting.com/t/selenium-page-object-model/71959):
>
> I am rewriting a Selenium project I have previously written in Java. I am really a beginner, but I am upgrading it and am using Maven as well as using the Page Object Model for my project. I have created two packages as src/main/java/tests and src/main/java/pages. Is it standard practice to initialise the WebDriver within the src/main/java/tests package or should you place it src/main/java or even entirely separately? The code for Initializing the WebDriver and passing the users data to login u…

> [@Page Objects and "fluent"](https://club.ministryoftesting.com/t/page-objects-and-fluent/62838):
>
> If enough people ask for background, I’ll make a separate explainer thread about page objects and fluent test writing style. But for clarity I’m wanting to stick to the meat of it. In POM (Page Object Model) speak a page object is an object that can be used to manipulate the UI of an app, where named instances of the object represent each of the possible dialogs in the app. The model is the way we can work with app dialogs as if they are interchangeable and each object to represent a page is b…

> [@Should assertions conditions be done in the page Objects, or in the Test classes?](https://club.ministryoftesting.com/t/should-assertions-conditions-be-done-in-the-page-objects-or-in-the-test-classes/67860):
>
> One thing that still baffles me to this day is, should we implement the methods to check our assertions conditions exclusively in Page Objects, or should we do those in our Tests? In other words, given a method: boolean isPlayButtonDisplayed() return driver.findElementByID(“play-btn”).isDisplayed(); (I’m erasing this as it probably isn’t a good example, so please refer to the example below) boolean doesDataTableCellTextEquals(int row, int column, string text) return driver.findElementByLoc…
