Skip to content

← All questions

Coming from Selenium PageFactory — what replaces @FindBy and initElements?

Example threads. These questions and answers were written by the SDODS team to document real problems and how to fix them. The people named are illustrative, not real users. Questions asked on this site are marked new.

We have a Java suite, maybe 300 tests, built the way everyone built them: a BasePage holding the driver and the waits, @FindBy(xpath = "//div[@class='cart']//button") fields, and PageFactory.initElements(driver, this) in every constructor. Glue code in a separate package maps Cucumber steps onto those page methods.

I am trying to work out what the equivalent shape is here before I start, because I do not want to port the mistakes as well. Specifically: what constructs the page object, where do the waits go, and does the glue layer survive?

3 answers

Know the answer?

Wrap commands and output in triple backticks and they will render as a code block.

Checking whether you’re signed in…

Have a different question? Ask it.

Related