title: org.openqa.selenium.NoAlertPresentException: no alert open
body: <p>My test checks to see if I can send a message to the mail.
  When I click the send button should check the alert.</p>
  
  <p>My code for alert is:</p>
  
  <pre><code>        Alert alert = driver.switchTo().alert();
          System.out.println(alert.getText());
          alert.accept();
          Assert.assertTrue(alert.getText().contains("Thanks."));
  </code></pre>
  
  <p>My error is:</p>
  
  <pre><code>Starting ChromeDriver 2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed) on port 13707
  Only local connections are allowed.
  
  org.openqa.selenium.NoAlertPresentException: no alert open
    (Session info: chrome=55.0.2883.87)
    (Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)
  Command duration or timeout: 76 milliseconds
  Build info: version: 'unknown', revision: '31c43c8', time: '2016-08-02 21:57:56 -0700'
  System info: host: 'Gaga', ip: '192.168.1.6', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_101'
  Driver info: org.openqa.selenium.chrome.ChromeDriver
  Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed), userDataDir=C:\Users\Dragana\AppData\Local\Temp\scoped_dir6652_7181}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=55.0.2883.87, platform=WIN8_1, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
  Session ID: b7131fce27b2ef40f1daff3c82188e7c
  </code></pre>