title: accept username , password from user and pass them as parameters to selenium web driver Junit test case
body: <pre><code>&lt;form action="GetFormData.jsp" method="post"&gt;
      Username:&lt;input type="text" name="txtUsername"&gt;&lt;br&gt;&lt;br&gt;
      Password:&lt;input type="password" name="txtPassword"&gt;&lt;br&gt;&lt;br&gt;
  &lt;/form&gt;  
  </code></pre>
  
  <p>Accept user credentials from user using this form and pass these values of username &amp; password to a Junit test case.   </p>
  
  <pre><code>@RunWith(Parameterized.class)   
  public class SeleniumTestcaseParameterized {
  
  WebDriver driver;
  private String userName,password;
  public SeleniumTestcaseParameterized(String userName,String password)
  {
      this.userName=userName;
      this.password=password;
  }
  
  @Parameters
  public static Collection&lt;Object[]&gt; data(){
  
      Object[][] data= new Object[][]{{"usernameFromForm","passwordFromForm"}};
      return Arrays.asList(data);
  }
   ........
  }
  </code></pre>
  
  <p>How to get these form values at runtime and pass as parameters?</p>