title: How to select an option from a dynamic dropdown using Selenium?
body: <p>I am trying to click on dropdown value to select city in from field in Make my trip <a href="http://www.makemytrip.com/" rel="nofollow noreferrer">http://www.makemytrip.com/</a>. But getting Stale element reference exception. Ids are getting changed on page load. 
  Tried below code:</p>
  
  <pre><code>driver.findElement(By.xpath(".//*[@id='hp-widget__sfrom']")).clear();
  driver.findElement(By.xpath(".//*[@id='ui-id-1']"));
  driver.findElement(By.xpath(".//*[@id='hp-widget__sfrom']")).click();
  WebDriverWait wait = new WebDriverWait(driver, 30);
  wait.until(ExpectedConditions.elementToBeSelected(driver.findElement(By.xpath(".//*[@class='ui-menu-item'][2]"))));
  </code></pre>