Approach 3: Using PageFactory for exposing elements

public BmiFunctions() {
   PageFactory.initElements(CommonFunction.getDriver(),this);
}

@FindBy(xpath = "//a[.='Metric Units']")
WebElement metricTab;

@FindBy(name = "cage")
WebElement age_txt;

...

Last updated

Was this helpful?