title: The loop is not working correctly
body: <p>I have written this loop below. It executes perfectly fine in the first iteration; however, in the second iteration, it returns the following error:</p>
  
  <pre><code> Unable to locate element: 
  
      {"method":"xpath","selector":"html/body/header[2]/div[2]/nav/ul/li[2]/a"}`
  
  Command duration or timeout: `120.06` seconds
  </code></pre>
  
  <p>The loop code is mentioned below:</p>
  
  <pre><code>    Workbook w2;
      w2 = Workbook.getWorkbook(new File("C:\\Users\\pcs\\Desktop\\flightdata.xls")); //flight data destintion location will be same as source from flight data.
      Sheet s2 = w2.getSheet(0);
  
      for (k = 1; k &lt; s2.getRows(); k++)
      {   
        //redeem flow
        d1.findElementByXPath("html/body/header[2]/div[2]/nav/ul/li[2]/a").click();
        d1.findElementByXPath("html/body/header[2]/div[2]/nav/ul/li[2]/ul/li[3]/a").click();
        d1.findElement(By.xpath("html/body/section/div[1]/form/div/div[2]/div[1]/div/div[1]/input")).sendKeys(s2.getCell(0, k).getContents());
  
        //pause for list to be populated
        try 
        {
          Thread.sleep(1000L);
        }
        catch (Exception e)
        {
        }
  
        //Get all items in autocomplete list
        List&lt;WebElement&gt; items1 = d1.findElements(By.xpath("html/body/ul/li[3]/a"));
  
         //Look for item 
         for( i= 0; i &lt;items1.size();i++)
         {
           if(items1.get(i).getText().contains(s2.getCell(0, k).getContents()))
           {
             items1.get(i).click();
             break; 
           }
         }  
  
           //calendar handling
           d1.findElementById("checkin").click();
           d1.findElementByXPath("html/body/div[2]/div[2]/div/a/span").click();
           d1.findElementByXPath("html/body/div[2]/div[2]/table/tbody/tr[3]/td[3]/a").click();
  
          //Select Number of Rooms
          d1.findElementById("roomscount").sendKeys("1");
  
          //Select Room type       
          d1.findElementById("roomtype").sendKeys("Single"); 
  
          //Occupant's Nationality    
          d1.findElementById("nationality").sendKeys("India");
  
          //Click search button       
          d1.findElementByXPath("html/body/section/div[1]/form/div/div[2]/div[4]/input").click();
  
          //after 2 min wait               
          d1.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);
      }  
  </code></pre>
  
  <hr>
  
  <p>POST SEARCH HTML PAGE</p>
  
  <pre><code>    &lt;!DOCTYPE html&gt;
      &lt;html&gt;
      &lt;head&gt;
      &lt;body class="" ondrop="return false;" ondragstart="return false;" onunload="" onpageshow="if (event.persisted) noBack();" onload="noBack();"&gt;
      &lt;header&gt;
      &lt;div class="logo"&gt;
      &lt;div class="right"&gt;
      &lt;ul class="login"&gt;
      &lt;nav class="links"&gt;
      &lt;ul&gt;
      &lt;li&gt;
      &lt;li&gt;
      &lt;a href="#"&gt;Redeem sMiles&lt;/a&gt;
      &lt;ul&gt;
      &lt;li class="pointer sprite"&gt; &lt;/li&gt;
      &lt;li class="flight"&gt;
      &lt;li class="hotel"&gt;
      &lt;a href="hotel.html?action=hotels"&gt;
      &lt;span class="sprite"&gt; &lt;/span&gt;
      Hotels
      &lt;/a&gt;
      &lt;/li&gt;
      &lt;li class="smiles"&gt;
      &lt;/ul&gt;
      &lt;/li&gt;
      &lt;/ul&gt;
      &lt;/nav&gt;
      &lt;div class="clear"&gt;&lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="clear"&gt;&lt;/div&gt;
      &lt;/header&gt;
      &lt;div class="clear"&gt;&lt;/div&gt;
      &lt;script src="/fm/travel/js/hotel.js" type="text/javascript"&gt;
      &lt;meta content="text/html; charset=utf-8" http-equiv="Content-Type"&gt;
      &lt;link type="text/css" rel="stylesheet" href="/fm/styles/demo_table_jui.css"&gt;
      &lt;link rel="stylesheet" href="/fm/travel/styles/ui-lightness/jquery-ui-1.10.4.css"&gt;
      &lt;link rel="stylesheet" href="/fm/travel/styles/ui-lightness/autocomplete.css"&gt;
      &lt;script src="/fm/travel/js/jquery-1.10.2.js" type="text/javascript"&gt;
      &lt;script src="/fm/travel/js/jquery-ui-1.10.4.js" type="text/javascript"&gt;
      &lt;script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&amp;sensor=false"&gt;
      &lt;script type="text/javascript"&gt;
      &lt;script type="text/javascript"&gt;
      &lt;script type="text/javascript"&gt;
      &lt;div id="loader" style="display: none;"&gt;
      &lt;div id="modifySearchBlock" style="display: block;"&gt;
      &lt;div class="clear"&gt;&lt;/div&gt;
      &lt;footer&gt;
      &lt;script src="/fm/travel/js/jquery.js"&gt;
      &lt;script src="/fm/js/bootstrap.min.js"&gt;
      &lt;script src="/fm/js/jquery.meanmenu.js"&gt;
      &lt;script&gt;
      &lt;script src="/fm/js/jquery.simpleGal.js"&gt;
      &lt;script&gt;
      &lt;script src="/fm/js/owl.carousel.js"&gt;
      &lt;script&gt;
      &lt;div id="ui-datepicker-div" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"&gt;&lt;/div&gt;
      &lt;ul id="ui-id-1" class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-corner-all " tabindex="0" style="display: none;"&gt;&lt;/ul&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>The above code belongs to the page where I return once search is completed.</p>
  
  <p>Again I need to go to the below link to do the search:</p>
  
  <p><img src="https://i.stack.imgur.com/MdD2W.jpg" alt="enter image description here"></p>
  
  <pre><code>&lt;li class="flight"&gt;
  &lt;li class="hotel"&gt;
  &lt;a href="hotel.html?action=hotels"&gt;
  &lt;span class="sprite"&gt; &lt;/span&gt;
  Hotels
  &lt;/a&gt;
  &lt;/li&gt;
  &lt;li class="smiles"&gt;
  &lt;/ul&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>The above code belongs to the link which I need to click. please provide same suggestions.</p>