Java – the best way to store locators

I'm focusing on Selenium's automated page object design pattern, and I can guess that many people store locators in Properties file and access them in the code It seems great to put the positioner in different positions

Since I haven't participated in any major project on selenium automation, I want to know my ideas about following so that I can avoid possible problems in the future:

>Is it useful to store locators in property files in large projects (more than 1000 test cases)?

a) If it doesn't help large projects, what's the difficulty in not storing locators in property files?

b) If it works, what precautions can be taken to make work easier? > Is it the best way to store the locator itself in a page class compared to a property file?

Solution

I think storing files in the page class itself Loading from a properties file incurs additional overhead or parsing large files It will be more difficult to keep such files. Even with good tool support, you will be forced to use Ctrl F

Even on a more conceptual level, it is wrong Suitable for storing in property files are configurable parameters, especially those suitable for adjustment at run time

Locators do not have this property If the benefit you are seeking is to declare in a central place, you should use a dedicated constant class, which will provide you with better refactoring options

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>