title: Cannot get alert() box in Selenium WebDriver with Chrome
body: <h2>In brief</h2>
  
  <p>Today I cannot get my code here <a href="https://github.com/namgivu/automation-testing/blob/master/util/sandbox/my_sandbox/test_alert_box_00.py" rel="nofollow noreferrer">00</a> <a href="https://github.com/namgivu/automation-testing/blob/master/util/sandbox/my_sandbox/test_alert_box_01.py" rel="nofollow noreferrer">01</a> works to get javascript alert() box from Python with Selenium WebDriver.</p>
  
  <h2>In full</h2>
  
  <p>My <a href="https://www.google.com.vn/search?q=selenium+python+javascript+alert&amp;oq=selenium+python+alert+js&amp;aqs=chrome.1.69i57j0.7583j0j7&amp;sourceid=chrome&amp;ie=UTF-8#newwindow=1&amp;q=selenium+python+javascript+alert+not+working+for+chrome+webdriver" rel="nofollow noreferrer">google search</a> on the topic gave me many results e.g. <a href="https://stackoverflow.com/a/40261556/248616">this one</a> using <code>EC.alert_is_present()</code> and <code>driver.switch_to_alert()</code></p>
  
  <pre><code>from selenium.webdriver.support.ui import WebDriverWait
  from selenium.webdriver.support import expected_conditions as EC
  
  driver = webdriver.Chrome()
  driver.get("...some page...")
  WebDriverWait(driver, 5).until(EC.alert_is_present())
  driver.switch_to_alert().accept()
  </code></pre>
  
  <p>I follow that and write a simple code on my github here <a href="https://github.com/namgivu/automation-testing/blob/master/util/sandbox/my_sandbox/test_alert_box_00.py" rel="nofollow noreferrer">00</a> <a href="https://github.com/namgivu/automation-testing/blob/master/util/sandbox/my_sandbox/test_alert_box_01.py" rel="nofollow noreferrer">01</a> trying to access the alert object from Python code. Though I failed with the timeout exception as below i.e. the webdriver cannot get the alert() box object.</p>
  
  <pre><code>Traceback (most recent call last):
    File "util/sandbox/my_sandbox/test_alert_box.py", line 49, in &lt;module&gt;
      WebDriverWait(driver,10).until(EC.alert_is_present()) #TODO Why alert box not available? We got error here
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/support/wait.py", line 80, in until
      raise TimeoutException(message, screen, stacktrace)
  selenium.common.exceptions.TimeoutException: Message: 
  </code></pre>
  
  <p>So if you know how to get it work, please share. Thank you!</p>