title: How to call a webelement from one class to another class in selenium webdriver
body: <p>I have a class 'Registration.java' where i defined a web element as like below:</p>
  
  <pre><code>WebElement regForm = driver.findElement(By.xpath("html/body/div[2]/div[1]/div/form"));
  List&lt;WebElement&gt; inputFields = regForm.findElements(By.xpath(".//div[@class='form-con']/input"));
  </code></pre>
  
  <p>Another class 'Validations.java':</p>
  
  <pre><code>List&lt;WebElement&gt; errors = **regForm**.findElements(By.xpath(".//div[@class='error-container']/small"));
  for(int i = 0; i &lt; inputFields.size(); i++){
      **inputFields**.get(i).sendKeys("");
      driver.findElement(By.xpath(".//div[@class='signin-con']/input")).click(); }
  </code></pre>
  
  <p>In the above example, 'Registration.java' class has web element objects 'regForm' and 'inputFields'. I don't want to define again same in the second class. So, those web elements want to use in the another class 'Validations.java'. But, Java program is showing error 'object cannot be resolved' in the second class. How can I call those webelements without re-defining again?</p>