I have several inherited classes that all have similar web elements. It is just that in each sub class, the actual xpath of the elements is different. All the interactions I want to do are the same among all the subclasses, except for the xpath.
I want to do something like
@FindBy(xpath = *somehow passed in constructor from subclass*)
private WebElement searchBox;
in the superclass. Then I can have my methods which act on the elements passed into it. I don't think I can pass the element from the subclass because the element will be dynamic, and this will be done statically (or just one time, and the element could change).
I can't define the xpaths in the super class as the xpaths are different in each subclass.
I would appreciate any suggestions. I suppose I could pass the strings and do my own finds if necessary (driver.findElement(By.xpath(...))
Oh, this is to be done with Java and Eclipse