title: No modal dialog is currently open exception in selenium
body: <p>When I use switch to alert command it shows No modal dialog is currently open exception.</p>
  
  <pre><code>driver.switchTo().alert().getText();
  </code></pre>
  
  <p>I also set capability for the browser as ignore.</p>
  
  <pre><code>capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.IGNORE);
  </code></pre>
  
  <p>Below is the error message i got. Pls help me to come out of it.</p>
  
  <pre><code>1500030784208   geckodriver INFO    Listening on 127.0.0.1:27904
  1500030784593   geckodriver::marionette INFO    Starting browser C:\Program Files (x86)\Mozilla Firefox\firefox.exe with args ["-marionette"]
  [GFX1]: Potential driver version mismatch ignored due to missing DLLs igd10umd32 v= and igd10iumd32.dll v=0.0.0.0
  1500030787614   Marionette  INFO    Listening on port 54311
  Jul 14, 2017 4:43:08 PM org.openqa.selenium.remote.ProtocolHandshake createSession
  INFO: Detected dialect: W3C
  3 Registration
  FAILED: main
  org.openqa.selenium.NoAlertPresentException: No modal dialog is currently open
  Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
  System info: host: 'DESKTOP-3QEMR32', ip: '192.168.1.23', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_131'
  Driver info: org.openqa.selenium.firefox.FirefoxDriver
  Capabilities [{moz:profile=C:\Users\Admin\AppData\Local\Temp\rust_mozprofile.mdPh9bfiW9bk, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=54.0.1, platformVersion=10.0, moz:processID=3676.0, browserName=firefox, javascriptEnabled=true, platformName=windows_nt}]
  Session ID: e937e2ca-0064-41df-a6b8-9809bf3e2219
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:150)
      at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:115)
      at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:45)
      at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
      at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:694)
      at org.openqa.selenium.remote.RemoteWebDriver$RemoteTargetLocator.alert(RemoteWebDriver.java:1020)
      at testCases.MandatoryOptionForApprovedByAfterSelectDiscountType.main(MandatoryOptionForApprovedByAfterSelectDiscountType.java:96)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
      at org.testng.TestRunner.privateRun(TestRunner.java:744)
      at org.testng.TestRunner.run(TestRunner.java:602)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
      at org.testng.SuiteRunner.run(SuiteRunner.java:289)
      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
      at org.testng.TestNG.runSuites(TestNG.java:1144)
      at org.testng.TestNG.run(TestNG.java:1115)
      at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
      at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
  </code></pre>