title: How to handle pop-up or alert in selenium?
body: <p>whenever I'm running my code, I'm getting pop-up.
  how to cancel that pop-up for the website : <a href="https://www.goibibo.com/" rel="nofollow noreferrer">https://www.goibibo.com/</a></p>
  
  <p>whenever I'm running my code, I'm getting pop-up.
  how to cancel that pop-up for the website : <a href="https://www.goibibo.com/" rel="nofollow noreferrer">https://www.goibibo.com/</a></p>
  
  <pre><code>package basic;
  import java.util.List;
  import org.openqa.selenium.By;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.WebElement;
  import org.openqa.selenium.chrome.ChromeDriver;
  import org.openqa.selenium.support.ui.ExpectedConditions;
  import org.openqa.selenium.support.ui.WebDriverWait;
  
  
  public class goibibo {
      private static WebDriver driver = null;
      public static void main(String[] args) throws InterruptedException  {
          // TODO Auto-generated method stub
          WebDriver driver = new ChromeDriver();
          driver.get("https://www.goibibo.com/");
          new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='gosuggest_inputSrc']"))).sendKeys("A");
          Thread.sleep(1000);
          List&lt;WebElement&gt; myList = new WebDriverWait(driver, 20).until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath("//div[@class='dib marginL10 pad0 textOverflow width90']/div/span")));
          for (int i = 0; i &lt; myList.size(); i++)
          {
                  System.out.println(myList.get(i).getText());
                  if (myList.get(i).getText().equals("Ahmedabad"))
                  {
                      myList.get(i).click();
                      break;
                  }
              }
          new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id=\"gosuggest_inputDest\"]"))).sendKeys("Mum");
          Thread.sleep(1000);
          List&lt;WebElement&gt; Dept = new WebDriverWait(driver, 20).until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath("//div[@class='dib marginL10 pad0 textOverflow width90']/div/span")));
          for (int j = 0; j &lt; Dept.size(); j++)
          {
                  System.out.println(Dept.get(j).getText());
                  if (Dept.get(j).getText().equals("Mumbai"))
                  {
                      Dept.get(j).click();
                      break;
                  }
          }
          Thread.sleep(3000);
          driver.switchTo().alert().dismiss();
      }
  
  }
  
  
  no such alert
  </code></pre>