0

I am wondering whether @FindBy annotation accepts xpath from properties or object repository file? and also please let me know , what is the practical approach ? a. Using Page object model having all CSS selectors and Methods to perform actions in page object. b. Having CSS selectors as key value pair in properties file and refer them in page object.

Langauge used is java

Thanks in Advance.!

0

I am wondering whether @FindBy annotation accepts xpath from properties or object repository file?

No, As far as I know, java annotations only accepts constant values like string literals etc. So If you use @FindBy annotation, you need to put selector as a string literal like:

@FindBy(css = "tbody[id$='some_css_in_here']")

About second question

Adding all selectors in properties file seemed much confusing to me since, after some time, too much selectors will be displayed in single properties file and you may have a hard time to remember which css selector belongs to which page (you can add comments to the properties file, but it is an additional work)

Although, putting css selectors into the page objects is much more readable for me, since during project, it will be easier to identify which css selectors belong to which page.

Like: Css selectors related with login page, will be located in LoginPage.java page object class.

Regards..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.