title: Unable to Parametrize Using TestNG in Selenium
body: <p>I am new to selenium and trying to parameterize username and password field using testing. This script only opens the URL for me and does nothing more. Can someone help me out here and let me know the appropriate way of achieving this?</p>
  
  <pre><code>import org.openqa.selenium.By;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.WebElement;
  import org.openqa.selenium.firefox.FirefoxDriver;
  import org.testng.annotations.BeforeMethod;
  import org.testng.annotations.BeforeSuite;
  import org.testng.annotations.BeforeTest;
  import org.testng.annotations.Parameters;
  import org.testng.annotations.Test;
  
   public class Testcase1 {
  
    WebDriver driver=new FirefoxDriver ();
    driver.get("URL");
   // driver.manage().timeouts().pageLoadTimeout(60,TimeUnit.SECONDS);
  
  @Test
  @Parameters({"sUsername","sPassword"})
  public  void login()
  
  {    
  
      WebElement objUsername = driver.findElement(By.xpath("//input[@placeholder='Username']"));
      objUsername.sendKeys("sUsername");
  
      WebElement objPassword = driver.findElement(By.xpath("//input[contains(@placeholder,'Password')]"));
      objPassword.sendKeys("sPassword");
  
      WebElement objLogin = driver.findElement(By.xpath("//span[contains(text(),'Login')]"));
      objLogin.click();
  
      if (driver.findElement(By.xpath("//a[.='LOGOUT']")).isDisplayed())
              {
          System.out.print("Test Case is Passed");
              }
      else
          System.out.print("Test Case is Failed");    
              }
  
  }
  </code></pre>
  
  <p>XML:</p>
  
  <pre><code>import java.util.concurrent.TimeUnit;
  
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"&gt;
  &lt;suite name="Smoke"&gt;
    &lt;test name="Testcase1"&gt;
      &lt;parameter name="sUsername" value="testuser"&gt;&lt;/parameter&gt;
    &lt;parameter name="sPassword" value="123"&gt;&lt;/parameter&gt;
    &lt;classes&gt;
          &lt;class name="org.param.testcases.Testcase1"&gt;
          &lt;/class&gt;
      &lt;/classes&gt;
  
      &lt;/test&gt; &lt;!-- Test --&gt;
  &lt;/suite&gt; &lt;!-- Suite --&gt;
  </code></pre>