title: Selenium WebDriver and PageFactory Initialization WebElement From Property File
body: <p>I am using selenium WebDiver and PageFacotry to initialize webelement,but I want to initialize element at runtime but value should come form xml file or property file.</p>
  
  <p>Below statement initialize LogIn_PG_POF all the element which are declare in LogIn_PG_POF class but I want to initialize how(it is a attribute of FindBy annotation) portion from the properties file or xml file so later on I can change easily no need to change in code portion.</p>
  
  <pre><code>LogIn_PG_POF LoginPage = PageFactory.initElements(driver, LogIn_PG_POF.class);
  </code></pre>
  
  <p>This is a LogIn_PG_POF</p>
  
  <pre><code>public class LogIn_PG_POF {
  
      final WebDriver driver;
  
      @FindBy(how = How.ID, using = "log")
      public WebElement txtbx_UserName;
  
      @FindBy(how = How.ID, using = "pwd")
      public WebElement txtbx_Password;
  
      @FindBy(how = How.NAME, using = "submit")
      public WebElement btn_Login ;
  
      // This is a constructor, as every page need a base driver to find web elements
      public LogIn_PG_POF(WebDriver driver){ 
          this.driver = driver; 
      } 
  
  }
  </code></pre>