The correct approach is to
In my opinion, using object repositories in Selenium projects is a bad practice.
The object repository concept comes from record-and-playback tools such as QTP.
The object repository is a tree-like structure that is created while recording a test.
It has attributes for each element of the page used in the test.
Selenium does not have any record-and-play feature for test automation (Selenium IDE is not an automation tool).
Using object repositories in Selenium projects (as property or csv or xml files) has many disadvantages such as
since each locator is a line in a text file, it is impossible to open the declaration of the locator in the IDE (using F3 or Open Declaration)
page object classes with no locator variables break the class encapsulation principle (methods of a class should execute on variables of a class)
object repositories do not scale well for big pages; since big pages are bad and should be broken down in small pages, should we not have object repositories for each page widget?
object repositories do not work with page factory
Read more about the disadvantages on this medium.com article:
https://medium.com/@alexsiminiuc3/dont-use-object-repositories-with-selenium-webdriver-ad14096528e5