When I use PageFactory.initElements in parent class, child class elements are initialized. How this is working?
public class PageBase {
public PageBase(WebDriver dr)
{
this.dr=dr;
PageFactory.initElements(dr, this);
}
}
Here in PageBase(parent), 'this' is reference of PageBase(parent) right? then how its initializing elements in below child class? is this because of inheritance[i.e something like child class also will be initialized with parent]?
public class LoginPage extends PageBase{
private WebDriver dr;
public LoginPage(WebDriver dr)
{
super(dr);
this.dr=dr;
//PageFactory.initElements(dr, this);
}
@FindBy(how=How.ID,using="Bugzilla_login")
WebElement weUserName;
@FindBy(id="Bugzilla_password")
WebElement wepassword;
@FindBy(how=How.XPATH,using="//input[@id='log_in']")
WebElement weLoginBtn;
}