title: Python: raise exception_class(message, screen, stacktrace) selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None Message:
body: <p>So i have been facing this problem in my python projects; whenever a javascript alert appears on my page(while working on the python CLI interpreter for ubuntu linux), every other instruction statement throws me this error</p>
  
  <blockquote>
    <p>raise exception_class(message, screen, stacktrace)
    selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
    Message: </p>
  </blockquote>
  
  <p>i mean even simple instructions such as browser.current_url as well as complex ones too.</p>
  
  <p>if i try to switch to the alert and accept it using </p>
  
  <blockquote>
    <p>browser.switch_to.alert.accept()</p>
  </blockquote>
  
  <p>this error comes up:</p>
  
  <blockquote>
    <p>raise exception_class(message, screen, stacktrace)
    selenium.common.exceptions.NoAlertPresentException: Message: No modal dialog is currently open</p>
  </blockquote>
  
  <p>i usually end up closing the browser and restarting the test all over again. This is stressful.</p>
  
  <p>i am using ubuntu linux 16.04 LTS + python 2.7 + selenium <strong>version</strong> = '3.4.3'</p>