Rayrun
โ† Back to Discord Forum

is it possible Seperate action methods and elements in POM design

hey friends, I'm new to playwright and trying to migrate from cypress. in cypress I was locating elements in POM file and using them in test files with chaining click type etc. it was super easy. however I couldn't handle same approach in playwright. The Pom videos I looked was locating elements and action methods in the POM file.

This thread is trying to answer question "Is it possible to separate action methods and elements in POM design?"

7 replies

is it possible Seperate action methods and elements in POM design

yes, make locator variables readonly and those will be accessible within test

sorry, I was using javascirpt. is it still possible with it?

same way pom examples makes actions (functions) accessible in test, the same way you can make just locators accessible

poszklanieinatestowanie
poszklanieinatestowanie

Yes, you can divide class to Page and Locators, then import Locators in Page and use them in action methods. Simple as that.

I guess I handled. thanks a lot friends. appreciate your time ๐Ÿ™

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].