title: Webdriver is Not able to read element-Null Pointer exception..
body: <p>I am Trying to Automate a Test sequence of Login - Booking - Cancellation.
  Till Booking its Fine , But moment it Reaches Cancellation, It throws a java lang Null-Pointer Exp.
  I rechecked and My locators(xpath) is correct(xpath-Checker) and I am Trying to getText() the Ticket Number and proceed to cancellation. </p>
  
  <p>Problem is whenever WebDriver is reaching the Booking confirmation Page , which Loads after a While, it Fails and Returns Null Pointer Exp..</p>
  
  <p>It may be a Loading Issue which is handled or I am messed up with my Java Concept...</p>
  
  <p>Please Help !! anyone...</p>
  
  <pre><code>public class StackOverflow { 
  
         public static  WebDriver driver;
         public static  Properties p;
         public static  FileInputStream f ;          
  
   @Test
          public void loginTest()  {
              System.out.println("Enter Login");
          Properties p=new Properties();
          FileInputStream f = null;
          try {
              f = new FileInputStream("D:\\BOSSFramework\\Framework\\locators.properties");
          } catch (FileNotFoundException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          try {
              p.load(f);
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }       
  
          driver = new FirefoxDriver();
          driver.get("https://in3.seatseller.travel/");
          driver.manage().window().maximize();
  
  
          try{
              driver.findElement(By.name(p.getProperty("login.username.textfield"))).sendKeys("UserName");
              driver.findElement(By.name(p.getProperty("login.password.textfield"))).sendKeys("Password");
              WebElement ele =driver.findElement(By.id(p.getProperty("login.signin.button")));
              ele.click();            
                  }
               catch (Exception e) {                  
                  }           
          }
  
  @Test (dependsOnMethods={"loginTest"})
          public void booking() throws InterruptedException{
              System.out.println("Enter Booking");
              // Type Bangalore on Source Field.. 
              Properties p=new Properties();
              FileInputStream f = null;
              try {
                  f = new FileInputStream("D:\\BOSSFramework\\Framework\\locators.properties");
              } catch (FileNotFoundException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              try {
                  p.load(f);
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  
                  WebDriverWait wait2 = new WebDriverWait(driver, 30);
                  wait2.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(p.getProperty("oneapp.source.textfield"))));
                  driver.findElement(By.xpath(p.getProperty("oneapp.source.textfield"))).sendKeys("Bangalore");
                  driver.findElement(By.xpath(p.getProperty("oneapp.source.textfield"))).sendKeys(Keys.TAB);
                  Thread.sleep(900L);         
  
                  // Type Mysore on Destination Field             
                  WebDriverWait wait1 = new WebDriverWait(driver, 30);
                  wait1.until(ExpectedConditions.presenceOfElementLocated(By.xpath(p.getProperty("oneapp.destination.textfield"))));
                  driver.findElement(By.xpath(p.getProperty("oneapp.destination.textfield"))).sendKeys("Tirupathi");
                  driver.findElement(By.xpath(p.getProperty("oneapp.destination.textfield"))).sendKeys(Keys.TAB);     
  
    }
  @Test (dependsOnMethods={"booking"})
  
                public void cancellation() throws InterruptedException{
                    System.out.println("Enter Cancellation");               
                      WebDriverWait wait4 = new WebDriverWait(driver, 60);
                      Thread.sleep(9000);
      /*Facing Null Pointer Exp  Here */                  
                      wait4.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(p.getProperty("oneapp.congratulations.text"))));
                      wait4.until(ExpectedConditions.presenceOfElementLocated(By.xpath(p.getProperty("oneapp.congratulations.text"))));
                      Thread.sleep(9000);
     /*Facing Null Pointer Exp  Here  */                  
                      WebElement ticket =driver.findElement(By.xpath(p.getProperty("oneapp.ticket.text")));   
     /*Want to getText() Ticket Number to cancel*/
                      String ticket1 = ticket.getText();
                      System.out.println(ticket1);
                      driver.findElement(By.xpath(p.getProperty("oneapp.leftNavCancel.link "))).click();                 
                      WebDriverWait wait1 = new WebDriverWait(driver, 30);
                      wait1.until(ExpectedConditions.presenceOfElementLocated(By.xpath(p.getProperty("oneapp.phoneNumber.textfield"))));
                      driver.findElement(By.xpath(p.getProperty("oneapp.phoneNumber.textfield"))).sendKeys(TIN1);                 
                      driver.findElement(By.xpath(p.getProperty("oneapp.search.button"))).click();
                      driver.findElement(By.xpath(p.getProperty("oneapp.cancel.button"))).click();  
  }
  }
  </code></pre>