Search code examples
mavenselenium-webdriverpageobjectscucumber-junit

Java Test Framework equivalent to Zend framework 2


I want to run one junit test on three different website. But in few cases, HTML element path is different in one of the website. For PHP, i found Zend framework 2 which provides option to override default code. Is there a framework in Java where code will be picked based on webshop?

Example: I have LogoutPageObject.java where Logout HTML element in website A and website B is //a[@class='item10'] and in Website C, it is //a[@class='item9']

My environment is: Eclipse + Maven + Junit + PageObject Model

Thanks for your help.


Solution

  • You can use @FindAll annotation to combine two or more locators as follows.

    @FindAll({ @FindBy(xpath="//a[@class='item10']") @FindBy(xpath="//a[@class='item9']")})

    This will find the elements based on the availability.