Below is my @findby
annotation with method, help to to get the value:
@FindBy(how = How.XPATH, using = "//*[@id='Voucher']")
public WebElement DropDownVoucherName;
public void voucher_ddp(String vddp) {
try {
Select vdp = new Select(DropDownVoucherName); vdp.selectByValue(vddp);
} catch (Exception e) {
System.out.println("Error found: "+e.getMessage());
}
}
Error getting:
NoSuchElementException: Cannot locate option with value : xyz
make sure you've initialised page factory in constructor with
PageFactory.initElements(driver, ClassName.class);