title: how to check the correct login credentials using a script in selenium webdriver
body: <p>I'm new to automation testing and I would like to know how to write a scripts to check whether I have entered a correct login details and if not correct I need to print a message.</p>
  
  <pre><code>public class NewTestOssLogin {
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          System.setProperty("webdriver.gecko.driver","D:/automation/geckodriver.exe");
  
          WebDriver driver = new FirefoxDriver();
          String url = "////test/url////";
          driver.get(url);
  
          System.out.println("page loaded successfully");
  
          driver.findElement(By.name("username")).sendKeys("test_vizua1");
          driver.findElement(By.name("password")).sendKeys("sanduni_123");
  
          driver.findElement(By.cssSelector("input[value='Login']")).click();
  
      }
  }
  </code></pre>
  
  <p>Here I wrote the script without conditions. I want to know how to write this script with if else conditions. </p>
  
  <p>I'll be thankful if anyone can help me to solve this.</p>